Scroll Area
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
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add scroll-areaAlso works with shadcn:
npx shadcn@latest add @ritla/scroll-areaDependencies it brings
@base-ui/reactOr 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
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.
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.
API reference
ScrollArea
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "vertical" | "horizontal" | "both" | "vertical" | Figma's Orientation. |
label | string | None | The area's name for screen readers (it becomes a region). |
bare | boolean | false | No frame, inside a panel or card. |
className | string | None | For the frame: a fixed height (vertical) or width (horizontal). |
contentClassName | string | None | For 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.
| Key | Action |
|---|---|
| Tab | To the area when it scrolls, or to the first control inside. |
| ArrowUpArrowDownPageUpPageDown | Scroll vertically. |
| ArrowLeftArrowRight | Scroll horizontally. |
ARIA
- Scrolling is native, so keyboard, wheel, touch and screen readers work as on any scrolling element.
- The bar is decorative; with
labelthe area is a namedregion. - 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.
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)