Skip to content
Cojeev UI

Scroll Area

Layout

Contains overflowing content in a bounded viewport with styled scrollbars.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/scroll-area.json

The command includes the component’s shared dependencies. Your project keeps editable source files.

Include the complete example

This example also composes typography. Install its parts together:

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/scroll-area.json https://luv-jeri.github.io/cojeev-ui/r/typography.json

Using scroll area

  • Set a height or width constraint so the viewport can scroll within its surrounding layout.

  • Add a horizontal ScrollBar when wide content needs horizontal scrolling.

API

Compose the exported parts below. The prop types are read from the React source during the registry build.

Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.

ScrollAreaProps

PropTypeRequired
variant"default" | "ink" | "plain" | null | undefinedNo
viewportClassNamestringNo
viewportProps

Native viewport attributes, including a ref, scroll listener or accessible name.

React.ComponentProps<typeof Primitive.Viewport>No
viewportWrapper

Compose a primitive around the actual scrolling element, preserving its ref.

(viewport: React.ReactElement) => React.ReactNodeNo

ScrollAreaListProps

PropTypeRequired
variant"default" | "ink" | "plain" | null | undefinedNo
viewportClassNamestringNo
viewportProps

Native viewport attributes, including a ref, scroll listener or accessible name.

React.ComponentProps<typeof Primitive.Viewport>No
viewportWrapper

Compose a primitive around the actual scrolling element, preserving its ref.

(viewport: React.ReactElement) => React.ReactNodeNo
maxHeightReact.CSSProperties["maxHeight"]No

ScrollBarProps

Accepts the native or primitive props declared by its exported TypeScript type.

PageScrollBarProps

Accepts the native or primitive props declared by its exported TypeScript type.

Accessibility

  • Keep scrolling content keyboard-reachable and give an independently scrollable region a useful name when it needs one.

States and appearance

rest

For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.

Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.