ScrollArea API

API documentation for ScrollArea component

ScrollArea#

Props#

Defines valid properties in ScrollArea component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ScrollAreaInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ScrollAreaInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ScrollAreaPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ScrollAreaInstance) => ReactNode)
null
The children to render.
stepnumber
5
Step factor to scroll the content while pressing the arrow keys.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in ScrollArea component.

nametypedefaultdescription
orientationStatestring
null
Current orientation of scrolling, either "vertical" or "horizontal".

Exposes#

Defines the methods and properties exposed by ScrollArea component.

nametypedefaultdescription
stateuseScrollAreaState
null
The state of the useScrollArea.
contentRefRefObject<HTMLDivElement>
null
Reference to the scroll content element.
thumbXRefRefObject<HTMLDivElement>
null
Reference to the horizontal scrollbar thumb element.
thumbYRefRefObject<HTMLDivElement>
null
Reference to the vertical scrollbar thumb element.
lastScrollLeftnumber
null
Current horizontal scroll position.
lastScrollTopnumber
null
Current vertical scroll position.
onScroll(event: UIEvent<HTMLDivElement>) => void
null
Event handler for content scrolling to update thumb positions.
onXBarMouseDown(event: MouseEvent<HTMLDivElement>) => void
null
Event handler for horizontal scrollbar thumb drag interactions.
onYBarMouseDown(event: MouseEvent<HTMLDivElement>) => void
null
Event handler for vertical scrollbar thumb drag interactions.
onFocus(event: FocusEvent<HTMLDivElement>) => void
null
Event handler when the scrollbar thumb receives focus.
onBlur() => void
null
Event handler when the scrollbar thumb loses focus.
onKeyDown(event: KeyboardEvent<HTMLDivElement>) => void
null
Event handler for keyboard navigation to scroll content.
onKeyUp() => void
null
Event handler to stop continuous scrolling when key is released.

Interfaces#

Defines passthrough(pt) options of ScrollArea component.

nametypedefaultdescription
rootScrollAreaPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
viewportScrollAreaPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the viewport's DOM element.
contentScrollAreaPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the content's DOM element.
thumbYScrollAreaPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the thumbY's DOM element.
thumbXScrollAreaPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the thumbX's DOM element.

Types#

Instance of ScrollArea component.

values
ComponentInstance<ScrollAreaProps, ScrollAreaState, ScrollAreaExposes>

ScrollAreaViewport#

Props#

Defines valid properties in ScrollAreaViewport component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ScrollAreaViewportInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ScrollAreaViewportInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ScrollAreaViewportPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ScrollAreaViewportInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by ScrollAreaViewport component.

nametypedefaultdescription
scrollareaScrollAreaInstance
null
Instance of the ScrollArea component.

Interfaces#

Defines passthrough(pt) options of ScrollAreaViewport component.

nametypedefaultdescription
rootScrollAreaViewportPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ScrollAreaViewport component.

values
ComponentInstance<ScrollAreaViewportProps, ScrollAreaViewportState, ScrollAreaViewportExposes>

ScrollAreaContent#

Props#

Defines valid properties in ScrollAreaContent component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ScrollAreaContentInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ScrollAreaContentInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ScrollAreaContentPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ScrollAreaContentInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by ScrollAreaContent component.

nametypedefaultdescription
scrollareaScrollAreaInstance
null
Instance of the ScrollArea component.

Interfaces#

Defines passthrough(pt) options of ScrollAreaContent component.

nametypedefaultdescription
rootScrollAreaContentPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ScrollAreaContent component.

values
ComponentInstance<ScrollAreaContentProps, ScrollAreaContentState, ScrollAreaContentExposes>

ScrollAreaThumbY#

Props#

Defines valid properties in ScrollAreaThumbY component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ScrollAreaThumbYInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ScrollAreaThumbYInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ScrollAreaThumbYPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ScrollAreaThumbYInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by ScrollAreaThumbY component.

nametypedefaultdescription
scrollareaScrollAreaInstance
null
Instance of the ScrollArea component.

Interfaces#

Defines passthrough(pt) options of ScrollAreaThumbY component.

nametypedefaultdescription
rootScrollAreaThumbYPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ScrollAreaThumbY component.

values
ComponentInstance<ScrollAreaThumbYProps, ScrollAreaThumbYState, ScrollAreaThumbYExposes>

ScrollAreaThumbX#

Props#

Defines valid properties in ScrollAreaThumbX component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ScrollAreaThumbXInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ScrollAreaThumbXInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ScrollAreaThumbXPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ScrollAreaThumbXInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by ScrollAreaThumbX component.

nametypedefaultdescription
scrollareaScrollAreaInstance
null
Instance of the ScrollArea component.

Interfaces#

Defines passthrough(pt) options of ScrollAreaThumbX component.

nametypedefaultdescription
rootScrollAreaThumbXPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ScrollAreaThumbX component.

values
ComponentInstance<ScrollAreaThumbXProps, ScrollAreaThumbXState, ScrollAreaThumbXExposes>

useScrollArea#

Props#

Defines valid properties in useScrollArea.

nametypedefaultdescription
stepnumber
5
Step factor to scroll the content while pressing the arrow keys.

State#

Defines valid state in useScrollArea.

nametypedefaultdescription
orientationStatestring
null
Current orientation of scrolling, either "vertical" or "horizontal".

Exposes#

Defines the methods and properties exposed by useScrollArea.

nametypedefaultdescription
stateuseScrollAreaState
null
The state of the useScrollArea.
contentRefRefObject<HTMLDivElement>
null
Reference to the scroll content element.
thumbXRefRefObject<HTMLDivElement>
null
Reference to the horizontal scrollbar thumb element.
thumbYRefRefObject<HTMLDivElement>
null
Reference to the vertical scrollbar thumb element.
lastScrollLeftnumber
null
Current horizontal scroll position.
lastScrollTopnumber
null
Current vertical scroll position.
onScroll(event: UIEvent<HTMLDivElement>) => void
null
Event handler for content scrolling to update thumb positions.
onXBarMouseDown(event: MouseEvent<HTMLDivElement>) => void
null
Event handler for horizontal scrollbar thumb drag interactions.
onYBarMouseDown(event: MouseEvent<HTMLDivElement>) => void
null
Event handler for vertical scrollbar thumb drag interactions.
onFocus(event: FocusEvent<HTMLDivElement>) => void
null
Event handler when the scrollbar thumb receives focus.
onBlur() => void
null
Event handler when the scrollbar thumb loses focus.
onKeyDown(event: KeyboardEvent<HTMLDivElement>) => void
null
Event handler for keyboard navigation to scroll content.
onKeyUp() => void
null
Event handler to stop continuous scrolling when key is released.

Types#

Instance of useScrollArea headless.

values
HeadlessInstance<useScrollAreaProps, useScrollAreaState, useScrollAreaExposes>