Scroll Area
Custom-styled scroll container with vertical and horizontal scrollbars that keeps native scrolling.
pnpm dlx @glinui/cli@latest add scroll-areaChangelog
Recent releases
Installation
pnpm dlx @glinui/cli@latest add scroll-areaPrefer the package?
Usage
Variants
Every vocabulary variant on the default tone. Omit variant to follow the ambient design style. Omitted variant renders a chromeless region like the shadcn primitive.
import { ScrollArea } from "@glinui/ui"
export function ScrollAreaVariantsDemo() { return ( <div className="grid gap-4 md:grid-cols-2"> <ScrollArea variant="glinr" className="h-24 w-full"><div className="space-y-1 p-3 text-sm"><div>First row</div><div>Second row</div><div>Third row</div><div>Fourth row</div></div></ScrollArea> <ScrollArea variant="solid" className="h-24 w-full"><div className="space-y-1 p-3 text-sm"><div>First row</div><div>Second row</div><div>Third row</div><div>Fourth row</div></div></ScrollArea> <ScrollArea variant="soft" className="h-24 w-full"><div className="space-y-1 p-3 text-sm"><div>First row</div><div>Second row</div><div>Third row</div><div>Fourth row</div></div></ScrollArea> <ScrollArea variant="outline" className="h-24 w-full"><div className="space-y-1 p-3 text-sm"><div>First row</div><div>Second row</div><div>Third row</div><div>Fourth row</div></div></ScrollArea> <ScrollArea variant="ghost" className="h-24 w-full"><div className="space-y-1 p-3 text-sm"><div>First row</div><div>Second row</div><div>Third row</div><div>Fourth row</div></div></ScrollArea> <ScrollArea variant="gradient" className="h-24 w-full"><div className="space-y-1 p-3 text-sm"><div>First row</div><div>Second row</div><div>Third row</div><div>Fourth row</div></div></ScrollArea> </div> )}Horizontal
A horizontal strip with its own scrollbar.
import { ScrollArea, ScrollBar } from "@glinui/ui"
export function Demo() { const shots = ["Overview", "Reports", "Billing", "Members", "Audit log", "Webhooks", "API keys", "Settings"] return ( <ScrollArea className="w-full max-w-lg whitespace-nowrap rounded-xl border border-[var(--line-soft)]" aria-label="Screens"> <div className="flex gap-3 p-4"> {shots.map((shot, index) => ( <figure key={shot} className="flex shrink-0 flex-col gap-2"> <div className="flex h-24 w-40 items-center justify-center rounded-lg bg-[var(--surface-3)] text-xs font-medium text-[var(--color-muted)]"> {index + 1} / {shots.length} </div> <figcaption className="text-sm font-medium">{shot}</figcaption> </figure> ))} </div> <ScrollBar orientation="horizontal" /> </ScrollArea> )}Accessibility
- Native scrolling is preserved, so wheel, touch, and keyboard scroll work as usual.
- The viewport is focusable with a visible violet focus ring so keyboard users can scroll it.
Keyboard Interactions
| Key | Action |
|---|---|
| Tab | Focus the viewport. |
| Arrow keys / PageUp / PageDown | Scroll the focused viewport. |
ARIA Attributes
- Add `aria-label` or `aria-labelledby` on the viewport region when it is a landmark.
Reduced Motion
Scrollbar fade transitions are disabled with reduced motion.
Affected properties
opacitybackground-colorAPI Reference
ScrollArea
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | SurfaceVariant | "default" | No | plain (chromeless) | Surface variant. Omit to follow the ambient design style (glinr by default, plain for minimal, glass for glass). |
tone | SurfaceTone | No | neutral | Colour tone for the vocabulary variants. |
viewportClassName | string | No | - | Class names applied to the scrollable viewport. |
type | "auto" | "always" | "scroll" | "hover" | - | hover | When scrollbars are visible (Radix). |
dir | "ltr" | "rtl" | - | - | Reading direction for scrollbar placement. |
ScrollBar
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
orientation | "vertical" | "horizontal" | - | vertical | Add a horizontal ScrollBar for wide content. |
tone | SurfaceTone | No | - | Auto-generated from TypeScript source. |
variant | SurfaceVariant | "default" | No | - | Surface variant. Omit (or `plain`) for a chromeless scroll region like the shadcn primitive. Vocabulary: glinr, solid, soft, outline, ghost, gradient, glass. Legacy `default` maps to glinr. |
viewportClassName | string | No | - | Class names for the scrollable viewport. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { ScrollArea } from "@glinui/ui"Source Files
Dependencies
@glinui/ui@radix-ui/react-scroll-areaclass-variance-authorityGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/scroll-area.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
ScrollAreaProps
ScrollAreaProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
tone | SurfaceTone | No | - | - |
variant | SurfaceVariant | "default" | No | - | Surface variant. Omit (or `plain`) for a chromeless scroll region like the shadcn primitive. Vocabulary: glinr, solid, soft, outline, ghost, gradient, glass. Legacy `default` maps to glinr. |
viewportClassName | string | No | - | Class names for the scrollable viewport. |
ScrollBarProps
No explicit fields extracted for this props type.