Scroll
A native scroll container with vertical, horizontal or two-axis scrolling.
Import
import { Scroll } from "@tarve/core";Usage
import { Scroll, Text } from "@tarve/core";
let offset = 0;
<Scroll
gap={8}
padding={12}
style={{ height: 240 }}
onScroll={(next) => {
offset = next;
}}
>
{Array.from({ length: 50 }, (_, index) => (
<Text key={index}>Row {index + 1}</Text>
))}
</Scroll>Props
| Prop | Type | Default |
|---|---|---|
onScroll | (offset: number, max: number) => void | — |
onScrollPosition | (position: ScrollPosition) => void | — |
orientation | ScrollOrientation | "vertical" |
speed | number | 1 |
Inherited from ViewProps 11 props
| Prop | Type | Default |
|---|---|---|
align | Style["align"] | — |
dismissOnOutside | boolean | — |
dragRegion | boolean | — |
flex | number | — |
focusable | boolean | — |
gap | number | — |
justify | Style["justify"] | — |
onOutsideClick | () => void | — |
padding | Style["padding"] | — |
portal | boolean | — |
windowAction | "minimize" | "toggleMaximize" | "close" | — |
Common props
Shared by every component. See descriptions →
childrenhighlightidkeymotionFromonHighlightonPasteonTransitionEndrovingGroupstyleTypes
type ScrollOrientation = "vertical" | "horizontal" | "both";interface ScrollPosition { x: number; y: number; maxX: number; maxY: number }