Optionalprops: TModuleProps<Scroll axis
Retrieves the module's callbacks instance.
The element to which the scrollbar is applied
Indicates whether the instance has been destroyed.
After destruction, destroy is a no-op.
The name of the module, derived from the class name
Scrollbar outer element
The element where the scrollbar is appended.
If parent is not set, it defaults to container or document.body (if applied to window).
Optional prefix for classnames used by the module
Current properties. Do not mutate these directly, use updateProps instead.
Returns the total scrollable distance.
The actual scrollable element.
Returns document.documentElement for window, otherwise the container itself.
Returns the total scroll width/height of the content.
Returns scrollTop or scrollLeft of the scrollable element.
Scrollbar thumb element (draggable handle)
Returns the current thumb size.
Scrollbar track element (the container of the thumb)
Returns the current track size.
Protected_addAdds prefixed classes to an element and removes them on destroy.
Skips classes that are already present on the element.
Target DOM element.
Unprefixed class name segments.
Protected_cnBuilds one or more prefixed class names.
Unprefixed class name segments.
Space-separated prefixed class string.
Protected_destroyInternal method to handle the destruction of the module. It removes all callbacks, destroys properties, and cleans up event listeners and class names.
Protected_emitEmits a callback event with a fixed payload.
Set default mutable props
Enables automatic adjustment of the scrollbar size.
Minimum size of the scrollbar thumb.
Accepts numeric values (interpreted as pixels) or CSS units (px, rem, vw, vh, svh).
Get default static props
Automatically hides the scrollbar when inactive.
Defines the scrolling axis for the scrollbar.
'x' for horizontal scrolling.'y' for vertical scrolling.Custom CSS class to be applied to the scrollbar track.
If false, no additional class is applied.
The element to which the scrollbar is applied.
Can be either the window or a specific HTML element.
Determines whether the scrollbar thumb is draggable.
The parent element where the scrollbar should be appended.
If false, the scrollbar is appended directly to the container.
For proper behavior, use parent when applying the scrollbar to an HTML element.
Debounce time (in milliseconds) for handling resize events. Helps improve performance by limiting the frequency of resize calculations.
Protected_handleMethod that is called when the module's properties mutate. In most cases, used to handle callbacks.
Adds a custom callback to the module.
The event type to listen for (e.g., 'props', 'destroy').
The function to execute when the event is triggered.
Additional settings for the callback.
Registers a function to run when the instance is destroyed.
If the instance is already destroyed, action runs immediately.
Cleanup function (for example remove listeners or DOM classes).
Resize the scrollbar.
Custom scrollbar for
window,HTMLElement, and Snap containers.scrollor Snapupdate)draggableis enabledautoHidefades the bar in on scroll and out after inactivityOne instance controls a single axis. Use separate instances for
xandy.Documentation