Scroll area
A React component in Beamline's Layout category, in the free sample.
A native scroll region with thin overlay thumbs and edge fades that show only where more content waits; thumbs can be dragged or clicked.
Use it for
- Scrolling regions inside panels: logs, lists, side panels, horizontal rows.
Not for
- The page itself (let the browser scroll).
Anatomy
- root
- viewport (native scroll)
- edge fades (mask)
- track
- thumb
- way back (jump: a secondary Button floating at its end)
Variants
- orientation: vertical, horizontal, both
- scrollbars: auto, always
States
- fits (no thumb, no fade)
- at top
- middle
- at end
- scrolling
- dragging thumb
- focus-visible (the look's focus ring on the root; the bar shows)
- far from the jump end (the way back shows)
Keyboard
- With a label the region is focusable: arrows, Page Up/Down, Home/End
Motion
The bar arrives at once when scrolling, pointed at or focused and fades over --pui-duration-considered after hideDelay; pointed at, the thumb firms up to the bar's full width at once and slims over --pui-motion-out. Edge fades switch with the scroll position (no animation). A scroll moves the thumbs directly (a transform per frame); the component renders again only when an end is reached or left, or a size changes. Focus is never animated. With jump, the way back rises in over --pui-motion-in once the view is a screenful away and leaves over --pui-motion-out at the end; it scrolls smoothly back (at once under reduced motion).
Props
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | string | "vertical" | Which way it scrolls. Default vertical. |
fade | number (px) | 24 | Length of the edge fades in px; 0 turns them off. Default 24. |
scrollbars / hideDelay | "auto" | "always" / number | — | scrollbars: auto: thumbs appear while scrolling or pointed at; always: they stay. hideDelay: ms the thumbs stay after scrolling stops. Default 800. |
label | string | — | Names the region and makes it focusable, so arrow keys and Page Up/Down scroll it. |
maxHeight / snap / wheelToHorizontal | CSS / CSS / boolean | — | maxHeight: Maximum height before the content scrolls. Defaults to unbounded content height. snap: CSS scroll-snap-type for the viewport, e.g. "x mandatory". wheelToHorizontal: For horizontal rows: a vertical wheel scrolls sideways. |
onEdgeChange | ({ top, bottom, left, right }) => void | — | Which ends are reached: for "load more" or a sticky header shadow. |
viewportRef / viewportClassName / viewportStyle | Ref / string / CSSProperties | — | viewportRef: Receives the scrolling viewport; no ref by default. viewportClassName: Classes on the scrolling viewport; no viewport override by default. viewportStyle: Inline styles on the scrolling viewport; no viewport overrides by default. |
style / ref | CSSProperties / native Ref | — | style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default. |
classNames | ScrollAreaClassNames | — | Classes for the named visual parts; no part overrides by default. |
jump / jumpLabel | "start" | "end" / string | — | jump: A way back that appears once the view is more than a screenful from this end (vertical): "start" for a log with the newest at the top, "end" for a feed or a chat that grows at the bottom. jumpLabel: The way back's words. Default "Back to the top" / "Back to the end". |
ref | Ref<HTMLDivElement> | — | Receives the documented root element; no ref by default. |
style | CSSProperties | — | Inline styles on the documented visual root; no inline overrides by default. |
children (required) | ReactNode | — | Content rendered inside the component. Required. |
scrollbars | "always" | "auto" | — | auto: thumbs appear while scrolling or pointed at; always: they stay. |
hideDelay | number | — | ms the thumbs stay after scrolling stops. Default 800. |
maxHeight | MaxHeight<string | number> | — | Maximum height before the content scrolls. Defaults to unbounded content height. |
snap | ScrollSnapType | — | CSS scroll-snap-type for the viewport, e.g. "x mandatory". |
wheelToHorizontal | boolean | — | For horizontal rows: a vertical wheel scrolls sideways. |
viewportClassName | string | — | Classes on the scrolling viewport; no viewport override by default. |
viewportStyle | CSSProperties | — | Inline styles on the scrolling viewport; no viewport overrides by default. |
viewportRef | Ref<HTMLDivElement> | — | Receives the scrolling viewport; no ref by default. |
onScroll | ((event: UIEvent<HTMLDivElement, UIEvent>) => void) | — | Reports the viewport scroll position; no handler by default. |
jump | "end" | "start" | — | A way back that appears once the view is more than a screenful from this end (vertical): "start" for a log with the newest at the top, "end" for a feed or a chat that grows at the bottom. |
jumpLabel | string | — | The way back's words. Default "Back to the top" / "Back to the end". |
className | string | — | Classes on the documented visual root; no override by default. |
Built from
Import
import { ScrollArea } from "@beamline/scroll-area";
Get it
Scroll area is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Scroll area is included in the free MIT sample. Get Beamline · Connect your agent
More in Layout
- Bezel: A double-bezel frame: an outer shell with a hairline, a small gap, and an inset panel with its own edge, so a preview, chart or media reads as set into…
- Carousel: A row of slides that snap into place: swipe on touch, drag or the arrows with a mouse, ← → when focused, or the dots; optional autoplay that pauses and…
- Card: A record or a small group of related content and actions: optional media, avatar, title, status, action, meta, free content and a Details toggle; plain…
- Resizable panels: Panes that trade space across draggable dividers; each divider is a focusable separator with arrow keys, limits, folding for collapsible panes and…
- UI root: Makes a region of any app a Beamline root: theme, brand and direction for everything inside, and a matching layer at page level where its menus, dialogs…
- Expandable card: A dense card that grows in place when asked: the frame resizes and the clamped preview opens into the full text.
- Accordion: Topics that open in place, one at a time or several: FAQs and settings sections; each header is a button (with an optional fact at its end), and the…
- Collapsible: One region that opens and closes in place from its trigger, its height animating to the content.
- Aspect ratio: Holds media, video and embeds at a fixed width-to-height ratio while the layout resizes.
- Direction: Sets left-to-right or right-to-left for everything inside: text and logical spacing flip, and Radix parts read the direction for keys and placement.
- Separator: A hairline between groups, horizontal or vertical; hidden from screen readers unless it carries meaning.