Unified UI

ScrollArea

A custom scrollbar container for consistent cross-browser scroll appearance. Built on Radix UI ScrollArea.

Overview

The ScrollArea component replaces native browser scrollbars with styled, consistent scrollbar tracks and thumbs that match the design system's visual language. Built on Radix UI's ScrollArea primitive for cross-browser consistency.


Installation

Install the component via the CLI in one command.

npx @work-rjkashyap/unified-ui add scroll-area
pnpm dlx @work-rjkashyap/unified-ui add scroll-area
npx @work-rjkashyap/unified-ui add scroll-area
bunx @work-rjkashyap/unified-ui add scroll-area

If you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.

Or install the full package

Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.

npm install @work-rjkashyap/unified-ui
pnpm add @work-rjkashyap/unified-ui
yarn add @work-rjkashyap/unified-ui
bun add @work-rjkashyap/unified-ui

Anatomy

import {
	ScrollArea,
	ScrollBar,
} from "@work-rjkashyap/unified-ui";

Examples

Vertical Scroll

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.

Horizontal Scroll

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12

Scrollbar Sizes

Small (sm)

List item 1 — some content here

List item 2 — some content here

List item 3 — some content here

List item 4 — some content here

List item 5 — some content here

List item 6 — some content here

List item 7 — some content here

List item 8 — some content here

List item 9 — some content here

List item 10 — some content here

Medium (md)

List item 1 — some content here

List item 2 — some content here

List item 3 — some content here

List item 4 — some content here

List item 5 — some content here

List item 6 — some content here

List item 7 — some content here

List item 8 — some content here

List item 9 — some content here

List item 10 — some content here

SizeTrack WidthDescription
sm6pxThin scrollbar for compact UIs
md10pxDefault scrollbar width

Visibility Types

type="always" — scrollbar always visible

Always visible scrollbar — item 1

Always visible scrollbar — item 2

Always visible scrollbar — item 3

Always visible scrollbar — item 4

Always visible scrollbar — item 5

Always visible scrollbar — item 6

Always visible scrollbar — item 7

Always visible scrollbar — item 8

type="hover" — scrollbar on hover (default)

Hover to see scrollbar — item 1

Hover to see scrollbar — item 2

Hover to see scrollbar — item 3

Hover to see scrollbar — item 4

Hover to see scrollbar — item 5

Hover to see scrollbar — item 6

Hover to see scrollbar — item 7

Hover to see scrollbar — item 8

Both Scrollbars

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

Props

ScrollArea

PropTypeDefaultDescription
type"auto" | "always" | "scroll" | "hover""hover"Scrollbar visibility behavior.
scrollbarSize"sm" | "md""md"Size of the scrollbar track.
showVerticalbooleantrueWhether to show the vertical scrollbar.
showHorizontalbooleanfalseWhether to show the horizontal scrollbar.
viewportClassNamestringAdditional CSS classes for the viewport element.
classNamestringAdditional CSS classes for the root element.

ScrollBar

PropTypeDefaultDescription
orientation"vertical" | "horizontal""vertical"Orientation of the scrollbar.
size"sm" | "md""md"Size of the scrollbar.
classNamestringAdditional CSS classes.

Accessibility

The custom scrollbars are purely decorative. Keyboard scrolling and assistive technology use the native scrollable region underneath.

  • Keyboard scrolling — Not intercepted; works natively via arrow keys, Page Up/Down, Home/End.
  • Screen readers — Announce the scrollable region naturally; custom scrollbar is invisible to assistive technology.
  • Focus management — Tab order and focus are preserved within the scrollable content.
  • Touch devices — Native touch scrolling is preserved; custom scrollbars are visual only.

Design Tokens

TokenUsage
--borderScrollbar thumb color
--muted-foregroundScrollbar thumb hover color
--mutedScrollbar track hover tint
--duration-fastTransition speed for hover
--easing-standardEasing curve for transitions

On this page