EQTY Lab Equality

Scroll Area

Deprecated scrollable container with custom scrollbars

View as Markdown

Overview

Scroll Area wrapped content in Radix UI Scroll Area so that overflowing content got a styled, cross-browser scrollbar instead of the native one.

This component is deprecated. Browsers now render restrained, theme-aware scrollbars of their own. New code should use a native scrollable element. Existing usage will be removed in a future release.

Migrating

Replace the component with an element that scrolls natively. Give it a height and an overflow, and leave the scrollbar alone — the browser draws one that already matches the user’s platform and colour scheme:

tsx
// Before
<ScrollArea className="h-48 max-w-lg">
  <div>{/* long content */}</div>
</ScrollArea>

// After
<div className="h-48 max-w-lg overflow-y-auto">
  <div>{/* long content */}</div>
</div>

Use overflow-x-auto for horizontal scrolling, in place of <ScrollBar orientation="horizontal" />.

Do not restyle the scrollbar. The styled-vertical-scrollbar and styled-horizontal-scrollbar utilities have been removed, and ::-webkit-scrollbar rules of your own are a WebKit-only fork of a control the browser already themes. Dialog and Sheet now scroll this way too.

Usage

Import the component:

tsx
import { ScrollArea } from "@eqtylab/equality";

Set a height on the Scroll Area and place your content inside:

tsx
<ScrollArea className="h-48 max-w-lg">
  <div>{/* long content */}</div>
</ScrollArea>

Example

Slots

NameDescription
ScrollAreaThe scrollable container. Wraps your content and renders a styled vertical scrollbar.
ScrollBarThe scrollbar element, exported for advanced composition (e.g. a horizontal bar).

Props

Scroll Area forwards the underlying Radix Scroll Area Root props (such as type and scrollHideDelay) in addition to the props below.

NameDescriptionTypeDefaultRequired
childrenThe content to render inside the scrollable viewport.ReactNode
classNameAdditional CSS classes applied to the container.string