Skip to content

Scrollbars Provider

@astryxdesign/core v0.7.1 · ScrollbarsProvider

Props ​

PropTypeDefaultDescription
enabledbooleantrueWhether the subtree uses custom scrollbars. When false, the subtree is not initialized and any scrollbars already attached are destroyed. In nested providers the inner one wins.
autoHide'never' | 'scroll' | 'leave' | 'move''scroll'When the scrollbar hides. never keeps it visible, scroll shows it while scrolling, leave hides it after the pointer leaves, move shows it while the pointer moves.
autoHideDelaynumber800Milliseconds to wait before auto-hiding.
optionsScrollbarsOptions—Options passed to OverlayScrollbars (PartialOptions). Deep-merged last, so it has the highest priority.

Slots ​

SlotDescription
defaultContent that uses the custom scrollbars.

Exports ​

ExportTypeDescription
useScrollbars(target: MaybeRefOrGetter<HTMLElement | null | undefined>, options?: UseScrollbarsOptions) => UseScrollbarsResultAttaches the custom scrollbar to a scroll container you wrote yourself. Does nothing without a ScrollbarsProvider above it. The container is the viewport and its children are not moved. Call it in a descendant of the provider.
UseScrollbarsOptions{ enabled?: MaybeRefOrGetter<boolean> }Second argument of useScrollbars. enabled defaults to true and controls whether this container uses it. If the outer provider is off, true has no effect.
UseScrollbarsResult{ active: Readonly<Ref<boolean>> }active tells you whether the custom scrollbar is attached to the element right now.
ScrollbarsProviderPropsTypeThe type behind the props table above.
ScrollbarsProviderSlotsTypeThe type behind the slots table above.
ScrollbarsOptionsPartialOptionsOverlayScrollbars option type, used by the options prop.
ScrollbarsAutoHide'never' | 'scroll' | 'leave' | 'move'Value type of autoHide.
ScrollbarsContextTypeWhat the provider gives its subtree: enabled, the merged options, and mount.
ScrollbarsHandle{ update, destroy }The handle mount returns, used to update options or destroy the scrollbar.
scrollbarsKeyInjectionKey<ScrollbarsContext>The injection key the provider uses.

Appearance variables ​

VariableDefaultDescription
--astryx-scrollbar-size10pxScrollbar thickness.
--astryx-scrollbar-thumbSecondary text color at 45%Thumb color.
--astryx-scrollbar-thumb-hoverSecondary text color at 70%Thumb color on hover and drag.
--astryx-scrollbar-tracktransparentTrack background.
--astryx-scrollbar-radius9999pxCorner radius of track and thumb.

Native attributes ​

The component renders no element of its own, so class and style are not forwarded.