Protected ReadonlyclsprefixReadonlydomThe underlying DOM element of the component.
ReadonlypropsThe properties passed to the component's constructor.
Adds one or more CSS classes to the component's DOM element. Multiple classes can be provided as a space-separated string.
The CSS class(es) to add.
Adds a DOM event listener to the component's DOM element.
The name of the DOM event (e.g., 'click', 'mouseover').
The event handler function.
If true, the listener is added to the beginning of the event listener list. Defaults to false.
Animates the component's DOM element using the Web Animations API.
An array of keyframe objects or a Keyframe object.
The duration of the animation in milliseconds, or a KeyframeAnimationOptions object.
Appends content to the end of the component's DOM element. Content can be a single Component, an array of Components, a string, an array of strings, raw HTML, an array of raw HTML, a number, or a boolean.
The content to append.
Removes all child nodes from the component's DOM element.
Disables the component.
The component instance for chaining.
Enables or disables the component.
This sets the disabled attribute and also propagates the disabled state to child input elements.
If true, the component is enabled; if false, it's disabled. Defaults to true.
The component instance for chaining.
Enumerates all child components of this component.
If true, searches all descendants; otherwise, only direct children.
An array of child Component instances.
Enumerates all child DOM nodes of this component. Not all nodes may be components.
If true, searches all descendant nodes; otherwise, only direct children.
An array of child DOM nodes.
Dispatches an event with a given name and payload to all registered listeners. If no listeners are registered for the event name, or if no EventSource has been initialized, this method does nothing.
The name of the event to fire.
The payload (event object) to pass to the listeners.
Returns the first child element as a Component instance.
The first child component, or null if none exists.
Gives focus to the component's DOM element.
The component instance for chaining.
Retrieves the value of an HTML attribute from the component's DOM element.
The name of the attribute.
The string value of the attribute, or null if not present.
Returns the size and position of the component's DOM element relative to the viewport.
A Rect object containing the bounding rectangle.
Gets the checked state (for checkboxes/radio buttons).
Retrieves the computed style for the component's DOM element.
A CSSStyleDeclaration object representing the computed styles.
Retrieves the value of a data-* attribute from the component's DOM element.
The suffix of the data- attribute (e.g., for data-foo, use "foo").
The string value of the data-* attribute, or null if not present.
Retrieves the integer value of a data-* attribute from the component's DOM element.
Returns undefined if the attribute is not present or cannot be parsed as a number.
The suffix of the data- attribute.
The integer value of the data-* attribute, or undefined.
Gets the numeric value (for type="number" or type="range").
OptionaldefNan: number
Default value if parsing fails (default: NaN).
Parsed number or defNan.
Gets the current text selection.
Object with start and length properties.
Retrieves the computed inline CSS style value for a specific property.
This only returns styles explicitly set via setStyle or setStyleValue, not inherited or stylesheet-defined styles.
The name of the CSS property.
The value of the inline CSS property.
Retrieves the value of a CSS custom property (CSS variable) for the component. The computed style of the element is used.
The name of the CSS variable.
The string value of the CSS variable.
Gets the current input value as a string.
Checks if the component's DOM element has a specific CSS class.
The CSS class name to check.
true if the class is present, false otherwise.
Checks if the component's DOM element currently has focus.
true if the component is focused, false otherwise.
Hides the component by applying the x4hidden CSS class.
The component instance for chaining.
Checks if the component is marked as disabled.
This checks for the presence of the disabled attribute.
The string value of the disabled attribute, or null if not present.
Validates the input (checks required constraint).
Checks if the component's DOM element is currently visible (i.e., not hidden by display: none).
true if the component is visible, false otherwise.
Returns the last child element as a Component instance.
The last child component, or null if none exists.
ProtectedloadReturns the next sibling element as a Component instance.
The next sibling component, or null if none exists.
Removes a previously registered event listener. If the listener was not found or no events were registered, this method does nothing.
The name of the event from which to remove the listener.
The specific listener function to remove.
Registers an event listener for a specific event name.
The listener will be invoked when an event with the given name is fired.
Returns an object with an off() method, which can be used to conveniently remove this specific listener.
The name of the event to listen for.
The callback function to execute when the event is fired.
An object containing an off() method to unsubscribe the listener.
Attaches a listener for global messages dispatched by the application. The listener is automatically removed when the component's DOM element is removed.
The callback function to execute when a global message is received.
Searches up the DOM tree for a parent element that is a Component and optionally matches a specific constructor.
Optionalcls: Constructor<T>
Optional. The constructor of the Component type to match.
The matching parent Component instance, or null if not found.
Prepends content to the beginning of the component's DOM element. Content can be a single Component, an array of Components, a string, an array of strings, raw HTML, an array of raw HTML, a number, or a boolean.
The content to prepend.
Returns the previous sibling element as a Component instance.
The previous sibling component, or null if none exists.
Queries the first descendant DOM element matching a CSS selector and wraps it as a Component instance.
The CSS selector string.
The first matching Component instance, or null if no match is found.
Queries all descendant DOM elements matching a CSS selector and wraps them as Component instances.
The CSS selector string.
An array of Component instances.
Releases pointer capture on the component's DOM element for a specific pointer.
The unique ID of the pointer.
Removes a specific child component from this component's DOM element.
The child component instance to remove.
Removes one or more CSS classes from the component's DOM element.
If * is passed as the class name, all classes will be removed.
Multiple classes can be provided as a space-separated string.
The CSS class(es) to remove, or * to clear all.
Removes all CSS classes from the component's DOM element that match a given regular expression.
The regular expression to match against class names.
Scrolls the component's DOM element into the visible area of the browser window.
Optionalarg: boolean | ScrollIntoViewOptions
Optional. A boolean (true for smooth scroll) or an object specifying scroll options.
Selects a text range.
Start position
Length of selection
Selects all text in the input.
Sets an ARIA attribute on the component's DOM element.
The name of the ARIA attribute (e.g., 'aria-label').
The value of the ARIA attribute.
The component instance for chaining.
Sets a single HTML attribute on the component's DOM element.
If value is null, undefined, or false, the attribute will be removed.
The name of the attribute.
The value of the attribute.
Sets multiple HTML attributes on the component's DOM element.
An object where keys are attribute names and values are their corresponding values.
The component instance for chaining.
Sets the checked state (for checkboxes/radio buttons).
Sets or removes a CSS class based on a boolean condition.
The CSS class to manage.
If true, the class is added; if false, it's removed. Defaults to true.
The component instance for chaining.
Replaces the entire content of the component's DOM element with new content. Any existing content will be cleared before the new content is added.
The new content to set. Can be a single item or an array of items.
Sets the value of a data-* attribute on the component's DOM element.
The suffix of the data- attribute.
The string value to set.
Sets multiple DOM event listeners on the component's DOM element.
An object where keys are event names and values are their corresponding handler functions.
Sets the height of the component.
The height value. Can be a number (interpreted as pixels) or a string (e.g., "100px", "50%").
idem as setData but onot on dom, you can store anything
Sets an interval that repeatedly executes a callback function after a specified delay. If a timeout with the same name already exists, it will be cleared before the new one is set.
A unique string identifier for this timeout.
The delay in milliseconds before the callback is executed.
The function to execute after the delay.
Sets a numeric value with optional decimal precision.
Numeric value to set.
Decimal places:
-1 = auto,
-2 = use step prop,
≥0 = fixed decimals.
Toggles read-only mode.
Sets multiple inline CSS styles on the component's DOM element.
Numeric values for properties like width or height will automatically append "px" unless they are unitless.
An object where keys are CSS property names and values are their corresponding styles.
The component instance for chaining.
Sets a single inline CSS style property on the component's DOM element.
Numeric values for properties like width or height will automatically append "px" unless they are unitless.
The component instance for chaining.
Sets a CSS custom property (CSS variable) on the component's DOM element.
The name of the CSS variable (e.g., '--my-color').
The value to set for the CSS variable.
Sets a timeout that executes a callback function after a specified delay. If a timeout with the same name already exists, it will be cleared before the new one is set.
A unique string identifier for this timeout.
The delay in milliseconds before the callback is executed.
The function to execute after the delay.
Sets the input value.
New value (converted to string).
Sets the width of the component.
The width value. Can be a number (interpreted as pixels) or a string (e.g., "100px", "50%").
Shows or hides the component.
It toggles the x4hidden CSS class.
If true, the component is shown; if false, it's hidden. Defaults to true.
The component instance for chaining.
Toggles the presence of one or more CSS classes on the component's DOM element. If a class is present, it's removed; otherwise, it's added. Multiple classes can be provided as a space-separated string.
The CSS class(es) to toggle.
Visits all descendant components of this component, executing a callback function for each.
The traversal stops if the callback returns true.
The callback function to execute for each component.
StaticcreateCreates a new Component or an array of Components from JSX elements. This method is typically called by the TypeScript/JavaScript compiler when JSX is transpiled.
The class constructor of the component, an HTML tag name string, a symbol for fragments, or a callback.
An object containing attributes and properties for the component.
Any child components or content passed within the JSX.
A Component instance or an array of Components.
StaticcreateCreates a fragment, which is an array of components without a parent DOM element. Used for grouping multiple children in JSX without introducing an extra DOM node.
An array of components.
StaticparentStatic method to search up the DOM tree for a parent element that is a Component and optionally matches a specific constructor. *
The starting DOM node from which to search upwards. *
Optionalcls: Constructor<T>
Optional. The constructor of the Component type to match. *
The matching parent Component instance, or null if not found.
Customizable input component supporting multiple types (text, number, date, etc.). Auto-generates CSS class:
x4input.Example
Cssvar