Scroll area
A box that scrolls: a thin scrollbar that floats over its edge and takes no room, and content that fades toward an edge with more beyond it.
<ScrollArea className="h-56 w-64 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> <ul className="flex flex-col p-2 text-body-2 text-neutral-fg-secondary"> {AGENTS.map((name) => ( <li key={name} className="px-2 py-1.5"> {name} </li> ))} </ul></ScrollArea>Installation
import { ScrollArea } from "@dome-systems/ds-dashboard/components";Anatomy
- billing-reconciler
- support-triage
- release-notes
- invoice-reader
- lead-scorer
- docs-search
- on-call-helper
- 1 — Content. As wide as the box: the scrollbar takes no room from it.
- 2 — Thumb. Round, 3px or 6px thick, set in from the edge. Stronger with the pointer on it.
- 3 — Fade. Toward an edge with more beyond it, as long as
fadeSizeat most. A mask: it paints no color.
A list that scrolls
Give it a height and put the content inside. Its scrollbar is a thin thumb on a track that is not drawn: it floats over the right edge and takes no room, so the content is as wide as the box. The content fades toward an edge that has more beyond it: nothing at the top until the list is scrolled. The examples below scroll this same list, as rows.
const rows = ( <ul className="flex flex-col p-2 text-body-2 text-neutral-fg-secondary"> {AGENTS.map((name) => ( <li key={name} className="px-2 py-1.5"> {name} </li> ))} </ul>);
<ScrollArea className="h-56 w-64 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)">{rows}</ScrollArea>Sideways, and both ways
orientation puts the thumb along the bottom (horizontal) or on both edges (both). The fades follow: left and right, or all four edges.
const wideRows = (count: number) => ( <div className="flex w-max flex-col p-2 text-body-2 text-neutral-fg-secondary"> {AGENTS.slice(0, count).map((name) => ( <div key={name} className="flex gap-6 px-2 py-1.5 whitespace-nowrap"> {COLUMNS.map((column) => ( <span key={column} className="w-28 shrink-0"> {column === "Agent" ? name : column} </span> ))} </div> ))} </div>);
<div className="flex flex-col gap-6"> <ScrollArea orientation="horizontal" className="w-96 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {wideRows(3)} </ScrollArea> <ScrollArea orientation="both" className="h-56 w-96 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {wideRows(16)} </ScrollArea></div>The thumb
Two settings, each on its own. scrollSize is the thumb's thickness: sm (3px) or lg (6px). inset is how far it sits in from its edge and from its ends: sm (2px), md (4px) or lg (6px). Both are sm unless set. With the pointer on it the thumb takes a stronger color and keeps its width.
<div className="flex gap-6"> <div className="flex flex-col items-center gap-2"> <ScrollArea className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)">{rows}</ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">sm, sm</span> </div> <div className="flex flex-col items-center gap-2"> <ScrollArea scrollSize="lg" inset="lg" className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">lg, lg</span> </div></div>When the thumb shows
scrollbar is always (whenever the box overflows) or hover (only while the pointer is over the box, and while it scrolls). revealUntilScrolled decides in its place: the thumb shows until the box is scrolled, so nobody misses that there is more, then as hover. Scroll the third box, then move the pointer off it.
<div className="flex gap-6"> <div className="flex flex-col items-center gap-2"> <ScrollArea className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)">{rows}</ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">always</span> </div> <div className="flex flex-col items-center gap-2"> <ScrollArea scrollbar="hover" className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">hover</span> </div> <div className="flex flex-col items-center gap-2"> <ScrollArea revealUntilScrolled className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">revealUntilScrolled</span> </div></div>The fades' length
fadeSize is how far a fade reaches from its edge: xs (20px), sm (30px), md (40px), lg (60px, the default), or a number of px. fade={false} has none. A fade is a mask: it paints no color, so the box shows whatever is behind it.
<div className="flex gap-6"> <div className="flex flex-col items-center gap-2"> <ScrollArea fadeSize="xs" className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">xs</span> </div> <div className="flex flex-col items-center gap-2"> <ScrollArea className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)">{rows}</ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">lg</span> </div> <div className="flex flex-col items-center gap-2"> <ScrollArea fade={false} className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">no fade</span> </div></div>The fades' shape
fadeCurve is how the content comes back from the edge. soft brings it in evenly, so more of it shows than on the other two. strong, the default, keeps it faint near the edge and brings it in fast. medium sits between the two. A Scroll area inside another keeps its own curve.
<div className="flex gap-6"> <div className="flex flex-col items-center gap-2"> <ScrollArea fadeCurve="soft" className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">soft</span> </div> <div className="flex flex-col items-center gap-2"> <ScrollArea fadeCurve="medium" className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">medium</span> </div> <div className="flex flex-col items-center gap-2"> <ScrollArea fadeCurve="strong" className="h-56 w-40 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows} </ScrollArea> <span className="text-body-3 text-neutral-fg-secondary">strong</span> </div></div>A blur under the fade
fadeBlur also blurs what the fades cover, the most at the edge and none where the content shows in full. It is off unless asked for: the blur is redrawn on every frame of a scroll.
<ScrollArea fadeBlur className="h-56 w-64 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> {rows}</ScrollArea>Something that stays put
Mark what stays in place while the content scrolls with data-scroll-area-pin: the fades never cover it. A header the rows scroll under takes data-scroll-area-pin="header" (a pinned last row, "footer"): once it is stuck to its edge, the fade starts after it, over the rows only, and the thumb's track starts under it. A floating control takes the bare attribute, and only its own area is left uncovered. All of this needs fade on. A Scroll area inside another reads only its own pins.
<ScrollArea className="h-56 w-64 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> <div data-scroll-area-pin="header" className="sticky top-0 border-b border-(--neutral-border-muted) bg-(--card-background) px-4 py-2 text-label-3 text-neutral-fg"> Agent </div> {rows} <div data-scroll-area-pin className="sticky bottom-2 mr-2 ml-auto w-fit"> <Button size="sm" iconStart={ArrowUp} aria-label="Back to the top" onClick={(event) => event.currentTarget.closest("[data-slot=scroll-area-viewport]")?.scrollTo({ top: 0 })} /> </div></ScrollArea>Half a row
cutMidRow trims a list that overflows so its last visible row is cut through its middle: half a row says there is more below. It counts the rows that are a menu's items or a list's options (by their role): a list of other rows is left as it is. A Dropdown menu scrolls this way, and a Select set to open beside its trigger.
<ScrollArea cutMidRow fadeSize="xs" className="max-h-44 w-64 rounded-[10px] bg-(--card-background) shadow-(--card-shadow)"> <div role="listbox" aria-label="Agents" className="flex flex-col p-1 text-body-2 text-neutral-fg-secondary"> {AGENTS.map((name) => ( <div key={name} role="option" aria-selected={false} className="flex h-7 items-center px-2"> {name} </div> ))} </div></ScrollArea>In the dashboard
Where the dashboard scrolls in a Scroll area today. Most of it comes through another component: a menu, a Select, a table.
The sidebar
The dashboard's sidebar scrolls in one: the 3px thumb 2px in, a 30px fade on the soft curve, and the thumb shown until this browser has scrolled a sidebar once.
ds/components/sidebar.tsx (SidebarContent)
Every dropdown menu and every Select
Their lists scroll in one, with the 20px fade. A menu's last row is cut in half; a Select's only when it is set to open beside its trigger. In a Select, and in a menu with a search field, the list itself is the element that scrolls.
ds/components/dropdown-menu.tsx, ds/components/select.tsx
The Table's rows
A list's rows scroll under its pinned header, and sideways too in a table set to scroll that way: the 6px thumb 6px in, under the pointer only. The cover (SCROLL_AREA_PRESETS.cover) is over every edge the rows run on past: the 20px fade, linear, hiding 80% at the very edge, on the bottom (the top once scrolled) in either mode, and on the sides with Responsive off. A responsive table has no sideways fade.
ds/components/table/data-table.tsx
The Modal's body
A modal taller than the window scrolls its body in one, sideways too when its content is wider: the 6px thumb 4px in, under the pointer only, and the cover, 30px, over each edge the content runs on past and only there. A body of fields or of table rows ends two thirds through a row; running text is not cut. It is a stop of the Tab key while it overflows.
ds/components/modal.tsx
The assistant's panels
Its chats list, its suggestions and its settings each scroll in one, on the defaults.
components/assistant/chats-list.tsx, components/assistant/suggestions-panel.tsx, components/rules/assistant-settings-view.tsx
A block of setup values
The compute setup's values to copy scroll in one once they are taller than 288px.
components/compute/compute-setup-values.tsx
Accessibility
The box is not a tab stop, and the scrollbar is hidden from a screen reader: it is drawn for the pointer, which can drag the thumb. The wheel, a trackpad and touch scroll the box as they scroll any other.
What is inside keeps its own keyboard behavior. When the keyboard reaches something inside (a row, a link, a button), the box scrolls it into view; with fade on, clear of the fade and of a pinned header or footer. In a Select, and in a menu with a search field, the list is the element that scrolls; in a plain menu the Scroll area's own element scrolls and the menu moves the highlight.
A box with nothing focusable inside cannot be scrolled from the keyboard: see the open questions.
The fades and the blur are drawn only: they hide nothing from a screen reader. With reduced motion, a thumb that shows while the pointer is over the box appears and goes at once.
API Reference
ScrollArea
Besides these, the props of Base UI's ScrollArea.Root. A component that holds a Scroll area passes its look on as its scrollArea prop (ScrollAreaSettings): scrollSize, inset, fade, fadeOrientation, fadeSize, fadeCurve, fadeCover, fadeBlur, scrollbar and revealUntilScrolled. The Table does. A setting left out keeps that component's own default.
Named setups, SCROLL_AREA_PRESETS, are passed by name: menu, the 20px fade on the default curve, hiding all at the edge, for every menu's and the Select's list; and cover, the 20px fade, linear, hiding 80% at the very edge, for a table's rows where they run on past an edge (Responsive off).
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "vertical" | "horizontal" | "both" | "vertical" | Where the thumb runs: down the right edge, along the bottom, or both. |
scrollSize | "sm" | "lg" | "sm" | The thumb's thickness: 3px or 6px. |
inset | "sm" | "md" | "lg" | "sm" | How far the thumb sits in from its edge and from its ends: 2px, 4px or 6px. |
scrollbar | "always" | "hover" | "always" | The thumb whenever the box overflows, or only while the pointer is over the box and while it scrolls. |
revealUntilScrolled | boolean | string | — | The thumb shows until the box is scrolled, then as hover. true: until this box is scrolled, and again each time it is shown. A storage key: until this browser has scrolled a box under that key, once and for good, for every box with that key. It decides in place of scrollbar; false is off. |
scrollbarX | "always" | "hover" | — | The sideways thumb's own rule, where it differs from the other's. |
fade | boolean | true | The content fades toward an edge with more beyond it. |
fadeOrientation | "vertical" | "horizontal" | "both" | — | Which edges fade, where it differs from orientation: a box that scrolls both ways can fade only its sideways edges. |
fadeSize | "xs" | "sm" | "md" | "lg" | number | "lg" | The fades' length: 20, 30, 40 or 60px, or a number of px. |
fadeCurve | "soft" | "medium" | "strong" | "strong" | The fades' shape from the edge in. |
fadeCover | number | 1 | How much the fades hide at the very edge, 0 to 1: all of it, or less, so what runs on still reads as there. |
fadeBlur | boolean | false | The fades also blur what they cover. |
cutMidRow | boolean | false | A list that overflows ends on half a row. |
cutMidRowFallback | number | — | With cutMidRow, the box's max height in px until its rows can be measured. |
cutShare | number | 0.5 | With cutMidRow, how much of the last row in view shows: half, or another share (a modal's body: two thirds). |
cutRows | string | — | With cutMidRow, what a row is, as a selector, where the rows are not a menu's. |
focusable | boolean | false | The box is a stop of the Tab key while it overflows, with a ring, so the keyboard can scroll content that holds nothing to focus (a modal's text). |
viewport | ReactElement | — | Another element is the one that scrolls (a Select's list), so its own keyboard scrolling keeps working. |
viewportClassName | string | — | Styles the element that scrolls. |
contentClassName | string | — | Styles the wrapper around the children, which lays them out. |
data-scroll-area-pin
An attribute on anything inside that stays put while the content scrolls. It is read only with fade on.
| Prop | Type | Default | Description |
|---|---|---|---|
(no value) | attribute | — | The fades and the blur leave this element's area uncovered, wherever it sits: a floating control. |
"header" | attribute | — | A bar at the top: once it is stuck there, the top fade starts after it, and the thumb's track too. |
"footer" | attribute | — | A bar at the bottom: once it is stuck there, the bottom fade ends before it, and the thumb's track too. |
Tokens
In ds/tokens/scroll-area.css. The last row is not a token: it is a variable that what holds the Scroll area sets on it.
| Token | Value | What it sets |
|---|---|---|
--scroll-area-thumb-background | the text color at 12% — dark 20% | The thumb. |
--scroll-area-thumb-background-hover | the text color at 20% — dark 30% | The thumb with the pointer on it, and while it is dragged. |
--scroll-area-thumb-size-sm, -lg | 3px, 6px | The thumb's thickness at each scrollSize. |
--scroll-area-thumb-inset-sm, -md, -lg | 2px, 4px, 6px | How far in the thumb sits at each inset. |
--scroll-area-thumb-radius | 9999px | The thumb's round ends. |
--scroll-area-fade-size-xs, -sm, -md, -lg | 20px, 30px, 40px, 60px | The fades' length at each fadeSize. |
--scroll-area-fade-ramp-from | 0 | Where the fade starts from the edge, as a fraction of its length. |
--scroll-area-fade-curve-{soft|medium|strong}-1 to -9 | one value per tenth | Each curve: how much of the content shows a tenth, two tenths… of the way in. |
--scroll-area-fade-blur | 1.25px | With fadeBlur, the blur at the edge. |
--scroll-area-fade-skip-x-end | unset | Takes that much off the right fade's reach, for content that ends in something a fade should not announce: the Table sets it to its pinned Actions column. |
Rules
Written down
A box that scrolls is a Scroll area
A scrolling list, menu or panel is wrapped in one. A screen does not write overflow-auto on a box or style a native scrollbar.
From .claude/rules/dashboard-ui.md (rule 5).
The scrollbar takes no room
It floats over the box's edge, so the content is as wide as the box.
From ds/components/scroll-area.tsx and ds/README.md (ScrollArea).
Each place has its sizes
Sidebars: the thin thumb, the small inset, a 30px fade on the soft curve. A bar at the window's right edge: the thin thumb, the large inset, a 30px fade. A page's main content: the thick thumb, the large inset, the 60px fade. A modal's body: the thick thumb, the medium inset, the cover at 30px. Menus and the Select: the defaults, with the 20px fade, short enough that the last full row still reads.
From ds/README.md (ScrollArea).
The fade is a mask
It paints no color: the box shows whatever is behind it, a page, a sidebar's fill or a menu's frosted surface.
From ds/components/scroll-area.tsx and ds/README.md (ScrollArea).
Nothing pinned is covered
A sticky bar or a floating control carries data-scroll-area-pin, and the fades and the blur leave it uncovered.
From ds/components/scroll-area.tsx and ds/README.md (ScrollArea).
The blur stays opt-in
Each of its bands is redrawn on every frame of a scroll, so it is off unless a place asks for it.
From ds/README.md (ScrollArea).
A menu's list ends on half a row
The Dropdown menu, and a Select set to open beside its trigger, set cutMidRow: half a row says there is more below. A modal's body of fields sets it with cutShare at two thirds, as the column at a scrolling table's edge.
From ds/components/scroll-area.tsx and ds/README.md (ScrollArea).
Open questions
Do the boxes that still scroll another way move to this one?
OpenSeven files scroll through the older components/ui/scroll-area.tsx, four lists through the data grid's own, the Card's body through one it builds itself, and 58 files write overflow-auto or overflow-scroll on a box.
Not looked up.
Should a box with nothing focusable inside be a tab stop?
OpenThis one is not, so a long read-only text in it cannot be scrolled with the keys; Base UI's own default, the older scroll area and the Card's body are tab stops.
Not looked up.
Does the assistant's panel take the right-hand bar's sizes?
OpenThe written sizes for a bar at the window's right edge (the large inset, a 30px fade) are on no screen: the assistant's panel is on the defaults.
Not looked up.