Design system / Molecules
Molecule / Presentation
ScrollArea
ScrollArea provides a Radix viewport, scrollbar and corner for overflow content. The caller supplies region bounds and content. It does not virtualize items, load records or restore scroll position.
Live example
Current component with fictional data. Example changes are not persisted.
Responsibility
Viewport and scrollbar parts provide one bounded overflow contract. The caller supplies meaningful dimensions and content. All rendered items remain mounted; scrolling does not imply virtualization or pagination.
Public contract
The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.
| Prop / part | Type | Requirement | Responsibility |
|---|---|---|---|
| className / children / Root props | Radix Root props | Consumer sizing | Viewport fills the Root; a useful bounded height must come from the caller. |
| orientation | vertical | horizontal | ScrollBar · default vertical | Root inserts one default vertical ScrollBar; horizontal use requires explicit composition. |
| className / primitive props | ScrollBar props | Optional | Viewport is not exported separately and receives fixed wrapper classes. |
API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.
State and behavior
Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.
Native scrolling with Radix scrollbar mechanics. No data fetching, item selection, virtualization or scroll restoration policy lives here.
Dependencies
- Radix ScrollArea Root, Viewport, Scrollbar, Thumb and Corner
- cn()
Token and styling contract
These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.
bg-border- Thumb role.
ring-ring/50- Viewport focus role.
rounded-[inherit] / size-full- Viewport geometry from its bounded parent.
Boundaries and limitations
- Root className does not expose all Viewport props.
- Do not make nested scrolling a substitute for responsive page layout; essential content must remain reachable.
Where to make a change
Change wrapper anatomy in scroll-area.tsx; bounds and content lifecycle belong to the consumer. Preserve keyboard access and avoid introducing page-level overflow.
Selected real uses
No product consumer is recorded in this entry's selected-use notes. The implementation and specimen establish availability, not adoption. These notes are not an exhaustive usage scan.
These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.
Usage contract
import { ScrollArea } from "@/components/ui/scroll-area";
<ScrollArea className="h-64" aria-label="Related notes">{notes}</ScrollArea>Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.