Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

ScrollArea

Contained scrolling with themed scrollbars and optional smooth wheel motion for article reading.

CoreLayout & Containers@gaudi/design-system/core/ScrollAreaView in StorybookSource

Installation

pnpm add github:ahmadassaf/design-system

Import from @gaudi/design-system. Load @gaudi/design-system/global.css once and add transpilePackages: ['@gaudi/design-system'] in Next.js.

import { ScrollArea } from '@gaudi/design-system/core/ScrollArea';

Copy an example into your project with the shadcn CLI: npx shadcn@latest add https://design.gaudi.site/r/scroll-area-horizontal-gallery.json.

Usage

import { ScrollArea } from '@gaudi/design-system/core/ScrollArea';
<ScrollArea smooth className='h-[32rem]' aria-label='Blog post content'>{article}</ScrollArea>

Examples

Storybook

Wide table

Storybook

API

8 props

Accessibility

Give the viewport a useful accessible name using aria-label or aria-labelledby. Constrain the area dimensions and retain keyboard access. Reduced motion skips the smooth engine entirely; native scrolling remains available before hydration or if the enhancement cannot load. Nested scrollable content keeps its own wheel behavior.

Notes

  • Blog migration decision: use ScrollArea with smooth enabled as the main area hosting blog post content. Keep one article viewport, and pass its viewportRef to reading progress and heading navigation. Adapt the consuming layout, table of contents and route scroll restoration during that migration; this component does not migrate the blog shell itself.
  • Smooth scrolling is an enhancement to the existing ScrollArea owner, not a second global page scroller. Bound the height, including min-h-0 when using a flex layout. Avoid stacking a second document-wide smoothing engine around it.
  • Native fragment links, keyboard scrolling, focus, text selection and touch retain browser behavior. Pointer and keyboard intent interrupt any pending wheel inertia. Code, tables and other nested scroll regions scroll natively.
  • Theme the track and thumb through scrollbarClassName. Keep enough contrast and an adequate hit area. Use ScrollBar with orientation="horizontal" for content that deliberately overflows horizontally.
  • Inspired by Shadix UI Smooth Scroll Area. Gaudi composes its existing Radix viewport with the packaged Lenis engine; it does not load remote scripts or copy registry source.