Scroll
Scroll creates a controlled overflow region with themed scrollbars and edge affordances.
Installation
Add this component with the NateUI CLI.
Examples
Basic
Horizontal
Edge Shadow
Flex Size
Scroll To Position
API
Scroll wraps overflow content in a themed viewport and renders custom scrollbars around it. On touch-primary devices it falls back to native scrolling and scrollbars. Use Scroll.FlexSize when the scroll area needs to fill a flex container.
Scroll
| Prop | Description | Type | Default |
|---|---|---|---|
children | Content rendered inside the scroll viewport. | ReactNode | - |
className | Class names applied to the scroll root. | string | - |
contentClassName | Class names applied to the internal content wrapper. | string | - |
edgeShadow | Shows edge masks while content remains scrollable. | boolean | false |
offsetScrollbars | Adds viewport padding for scrollbars, either always or when present. | boolean | 'horizontal' | 'vertical' | 'present' | - |
onBottomReached | Called when vertical scrolling reaches the bottom. | () => void | - |
onScrollPositionChange | Reports current scroll coordinates on scroll. | ScrollPositionChangeHandler | - |
onTopReached | Called when vertical scrolling returns to the top. | () => void | - |
ref | Ref forwarded to the scroll root. | Ref<HTMLDivElement> | - |
scrollbars | Which custom scrollbar axes are rendered. | 'horizontal' | 'vertical' | 'both' | 'both' |
scrollbarSize | Custom scrollbar rail size; desktop rails remain at least 10px, with a 4px resting thumb that expands to 6px when the rail is hovered or pressed. | number | string | 4 |
scrollHideDelay | Delay before auto-hide/hover scrollbars hide after interaction. | number | 1000 |
type | Scrollbar visibility behavior. | ScrollType | 'hover' |
viewportProps | Native props applied to the viewport element. | ComponentProps<'div'> | - |
viewportRef | Ref forwarded to the viewport element for imperative scrolling. | Ref<HTMLDivElement> | - |
...nativeProps | Native props for the scroll root. | ComponentProps<'div'> | - |
Scroll.FlexSize
Scroll.FlexSize accepts the same props as Scroll, plus:
| Prop | Description | Type | Default |
|---|---|---|---|
flexRootClassName | Class names applied to the outer flex root. | string | - |