CraftUI

Scroll Area

A scrollable region with block scrollbars, reachable by keyboard.

Installation

npx shadcn@latest add @runqora/craft-scroll-area

Usage

import { ScrollArea } from "@/components/craft/scroll-area";

<ScrollArea className="h-64" label="Saved worlds">
  ...
</ScrollArea>;

The area needs a size to scroll within, so set a height for vertical scrolling or a width for horizontal scrolling.

Examples

Horizontal

Props

Prop

Type

Accessibility

  • The scrolling region can be reached with Tab and scrolled with the arrow keys.
  • Give it a label that says what it holds, since a screen reader user lands on it directly.
  • The custom scrollbars work with a pointer. The keyboard and touch use the browser's native scrolling.

Customization

The scrollbar is as wide as five units, and the thumb uses the secondary tokens.

<ScrollArea className="[--craft-secondary:#8c8d90]">...</ScrollArea>

Dependencies

Source

On this page