Skip to content

Scroll Area

Get Ritla UI

A fixed box with a slim scrollbar, for lists and card rows that must stay inside a set height or width.

Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned

Open in Figma

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add scroll-area

    Also works with shadcn: npx shadcn@latest add @ritla/scroll-area

  2. Dependencies it brings

    @base-ui/react

  3. Or copy by hand

    Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.

Usage

scroll-area.tsx
import { ScrollArea } from "@/components/ui/scroll-area";<ScrollArea label="Currencies" className="h-space-320 w-space-256" contentClassName="px-space-20 py-space-16">  …</ScrollArea>

Examples

A row of cards

orientation="horizontal". The box is narrower than the row so the last card peeks out, and people know there is more. In Arabic the row starts from the right.

EnglishMirroredArabic
LTR →

Inside a card

bare drops the frame inside a card that has one. The card's heading is pinned above, and only the list scrolls.

EnglishMirroredArabic
LTR →

API reference

ScrollArea

PropTypeDefaultDescription
orientation"vertical" | "horizontal" | "both""vertical"Figma's Orientation.
labelstringNoneThe area's name for screen readers (it becomes a region).
barebooleanfalseNo frame, inside a panel or card.
classNamestringNoneFor the frame: a fixed height (vertical) or width (horizontal).
contentClassNamestringNoneFor the scrolling content: padding and layout.

Usage guidelines

A scroll area is a fixed-height viewport with a thin overlay scrollbar. When to use it, its scrollbar side in Arabic, and the checks before handoff.

1. Scroll area

A fixed-height viewport with a thin overlay scrollbar. Use it for lists, logs and long menus inside a card.

Do

  • Fade the top and bottom edges when there is more content.
  • Keep the scrollbar at 10 px and show it while scrolling.

Don't

  • Use it for the page itself.
  • Hide the scrollbar on desktop.

2. Arabic and RTL

The vertical scrollbar sits on the inline end, so on the left in Arabic.

Before handoff

  • Vertical and horizontal scroll areas placed in both directions.

Accessibility

Keyboard

Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.

KeyAction
TabTo the area when it scrolls, or to the first control inside.
ArrowUpArrowDownPageUpPageDownScroll vertically.
ArrowLeftArrowRightScroll horizontally.

ARIA

  • Scrolling is native, so keyboard, wheel, touch and screen readers work as on any scrolling element.
  • The bar is decorative; with label the area is a named region.
  • Don't wrap whole pages: it's for panels, menus, tables and side lists.

Arabic and RTL notes

Mirrors

  • The vertical bar sits on the left.
  • Horizontal rows start from the right, and so does the thumb.

Does not mirror

  • Currency codes stay left to right.
Numerals
Numbers in the content follow the numerals setting.
Arabic typography
The area sets no type; the content brings its own styles.
Mixed-direction text
Codes inside Arabic rows go in <bdi dir="ltr">.

Do

  • The RTL variants, so the scrollbar moves to the other side.

Don't

  • Keep the scrollbar on the right in Arabic.
  • Mirror the horizontal scroll direction for images or charts.

Checks it passes

The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.

  • R042Clipped text: content wider than its box with overflow hidden and no ellipsis
  • R043Fixed-pixel-width container whose Arabic text exceeds the space
  • R050Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
  • R051letter-spacing applied to Arabic text (breaks the connected script)