Skip to documentation

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

Live preview

Current component with fictional data. Example changes are not persisted.

Example note 1: bounded content, actual scrollbar.

Example note 2: bounded content, actual scrollbar.

Example note 3: bounded content, actual scrollbar.

Example note 4: bounded content, actual scrollbar.

Example note 5: bounded content, actual scrollbar.

Example note 6: bounded content, actual scrollbar.

Example note 7: bounded content, actual scrollbar.

Example note 8: bounded content, actual scrollbar.

Example note 9: bounded content, actual scrollbar.

Example note 10: bounded content, actual scrollbar.

Example note 11: bounded content, actual scrollbar.

Example note 12: bounded content, actual scrollbar.

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.

Maintained component API notes; current source is authoritative
Prop / partTypeRequirementResponsibility
className / children / Root propsRadix Root propsConsumer sizingViewport fills the Root; a useful bounded height must come from the caller.
orientationvertical | horizontalScrollBar · default verticalRoot inserts one default vertical ScrollBar; horizontal use requires explicit composition.
className / primitive propsScrollBar propsOptionalViewport 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.

All molecules
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.