---
title: "Scroll Area"
description: "A box that scrolls natively with thin scrollbars of its own and optional edge fades."
url: https://gelatinui.com/components/scroll-area
markdown_url: https://gelatinui.com/components/scroll-area.md
access: free
install: "npx shadcn@latest add @gelatin-ui/scroll-area"
registry_item: https://gelatinui.com/r/scroll-area.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Scroll Area

> A box that scrolls natively with thin scrollbars of its own and optional edge fades.

Page: https://gelatinui.com/components/scroll-area

## When to use it

Best for: A long list or text in a fixed box, with thin scrollbars of its own.

- Set the size on the root: `h-72`, `max-h-60`, or `w-80`.
- Use `scrollbars` for `vertical`, `horizontal`, or `both`.
- Use `fade` for a soft edge where content is hidden.

## When not to use it

- For thousands of rows, use a [Data Table](https://gelatinui.com/components/data-table.md).

## Notes for agents

- It scrolls natively and does not virtualize.
- Children go in the content part. For a custom layout, use `ScrollAreaRoot` and the other parts.
- Short content renders no scrollbar, and the box leaves the tab order.
- `focusRing` sets where the keyboard ring sits.

## Anatomy

```text
ScrollArea
├─ ScrollAreaRoot (0..n)
├─ ScrollAreaViewport (0..n)
├─ ScrollAreaContent (0..n)
├─ ScrollBar (0..n)
├─ ScrollAreaThumb (0..n)
└─ ScrollAreaCorner (0..n)
```

## API reference

### ScrollAreaRoot

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `focusRing` | `"inset" \| "outside"` | "outside" | Where the focus ring sits when the Viewport has keyboard focus: `outside` (default) or `inset`, for a Scroll Area in a parent that clips or with a `sticky` child (`scrollFocusVariants` in `#/lib/scroll-focus`). |

Also takes every prop of Base UI `ScrollArea.Root`: https://base-ui.com/react/components/scroll-area

### ScrollAreaViewport

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `fade` | `"both" \| "horizontal" \| "none" \| "vertical"` |  | Fade the edges where content is hidden. Off by default. It adds almost nothing while scrolling (against 1.6 ms without it); the cost of a Scroll Area is Base UI updating its own state on each scroll frame, with or without the fade. |

### ScrollAreaContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### ScrollBar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `thumbProps` | `ScrollAreaThumbProps` |  | Props of the thumb inside. A `className` here adds to the component classes. |

Also takes every prop of Base UI `ScrollArea.Scrollbar`: https://base-ui.com/react/components/scroll-area

### ScrollAreaThumb

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### ScrollAreaCorner

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### ScrollArea

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `focusRing` | `"inset" \| "outside"` |  | Where the focus ring sits when the Viewport has keyboard focus: `outside` (default) or `inset`, for a Scroll Area in a parent that clips or with a `sticky` child (`scrollFocusVariants` in `#/lib/scroll-focus`). |
| `scrollbars` | `"both" \| "horizontal" \| "vertical"` | "vertical" | The scrollbars to show. `both` also adds the Corner. |
| `fade` | `boolean` | false | Fade the edges where content is hidden, on the axes of `scrollbars`. Off by default. |
| `viewportProps` | `Omit<ScrollAreaViewportProps, "fade">` |  |  |
| `contentProps` | `ScrollAreaContentProps` |  |  |
| `scrollbarProps` | `Omit` |  | Props of both scrollbars. The thumb takes `thumbProps`, so it has one place to set it. |
| `thumbProps` | `ScrollAreaThumbProps` |  |  |
| `cornerProps` | `ScrollAreaCornerProps` |  |  |

Also takes every prop of Base UI `ScrollArea.Root`: https://base-ui.com/react/components/scroll-area

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ScrollAreaRoot | `scroll-area` |  |  |  |
| ScrollAreaViewport | `scroll-area-viewport` |  |  | `scroll-fade` |
| ScrollAreaContent | `scroll-area-content` |  |  |  |
| ScrollBar | `scroll-area-scrollbar` | `data-hovering`, `data-scrolling` |  | `motion-timing` |
| ScrollAreaThumb | `scroll-area-thumb` | `data-orientation` |  |  |
| ScrollAreaCorner | `scroll-area-corner` |  |  |  |
| ScrollArea | `scroll-area` |  |  |  |

## Usage

Set a height on the root, put the content in the viewport, and add the scrollbar with its thumb.

```tsx title="release-notes.tsx"
import {
  ScrollAreaContent,
  ScrollAreaRoot,
  ScrollAreaThumb,
  ScrollAreaViewport,
  ScrollBar,
} from "@/components/ui/scroll-area";

const NOTES = [
  "4.2 · Notes save on the device first, then sync.",
  "4.1 · Search finds words inside PDF files.",
  "4.0 · Shared folders for teams of up to 50 people.",
  "3.9 · Dark mode follows the system setting.",
  "3.8 · Export a folder as one Markdown file.",
];

export function ReleaseNotes() {
  return (
    <ScrollAreaRoot className="h-48 w-80 rounded-lg border">
      <ScrollAreaViewport fade="vertical" aria-label="Release notes">
        <ScrollAreaContent className="flex flex-col gap-3 p-4 text-sm">
          {NOTES.map((note) => {
            return <p key={note}>{note}</p>;
          })}
        </ScrollAreaContent>
      </ScrollAreaViewport>
      <ScrollBar orientation="vertical">
        <ScrollAreaThumb />
      </ScrollBar>
    </ScrollAreaRoot>
  );
}
```

## Compose

Rules:

- Group with a Frame (`group-in-frames`): Put related panels in one `Frame` with its header and footer outside the panels, and keep a plain `Card` for one block of content.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/scroll-area
```

It adds 5 registry items: 3 files, 1301 lines, and the npm packages `@base-ui/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Table](https://gelatinui.com/components/table.md)
- [Sidebar](https://gelatinui.com/components/sidebar.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves focus to the box when it scrolls. |
| Arrow keys, Page Up, Page Down | Scroll the focused box. |

## Accessibility

The box takes the focus only when it scrolls.

The ring draws on the root, so a fade never covers it.
