Scroll area
import { ScrollArea, useStickToBottom, useScrollKeys, springScroll, runningScroll, revealInView } from "@arcadia/ui";Scrolls the app starts
ScrollArea
orientation- "vertical" | "horizontal" | "both"
- Default:
"vertical" overscroll- "contain" | "auto"
- Default:
"contain" scrollbar- "auto" | "shown" | "hidden"
- Default:
"auto" anchoring- boolean
- Default:
true scrolls- boolean
- Default:
true stickyBar- boolean
- Default:
false timeline- `--${string}`
viewportRef- Ref<HTMLDivElement>
contentRef- Ref<HTMLDivElement>
label- string
viewportProps- Omit<ComponentProps<"div">, "ref" | "children" | "style"> & { style?: Omit<CSSProperties, ViewportOverflow> }
jumpToLatest- { readonly shown: boolean; readonly onJump: () => void; readonly label?: string }
dropTarget- { readonly shown: boolean; readonly label: string; readonly icon?: IconName }
turnRail- { items: readonly ScrollAreaTurn[]; label?: string; onJump?: (id: string, index: number) => void }
rootStyle- ScrollAreaStyle
Rest props go to <div> props.
omega- number
- Default:
26 - Natural frequency in rad/s.
axis- "x" | "y"
- Default:
"y" - The axis it moves:
yspringsscrollTop,xspringsscrollLeft(negative right to left, as the browser counts it). onFrame- (top: number) => void
- After every write, with the new
scrollTop. onEnd- (reason: SpringScrollEnd) => void
- Once, with why it stopped.
whenBodyFocused- boolean
- Also take the keys while nothing has focus (
<body>): the app's main scroller. end- () => void
- End jumps to the bottom through this (a transcript's
jumpToBottom(true), which re-pins). onKey- () => void
- Called before a key moves the scroller, so a stick-to-bottom hook reads it as the reader's.