Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Layout

Scroll area

A region with a styled scrollbar for content that is taller or wider than its box.

Selector: mui-scroll-area

Import
import { ScrollArea } from '@mushilu-san/ui/layout';
PreviewCode

Loading example…

Overview

Scroll area clips its content and scrolls it inside a box with a themed scrollbar. Set orientation to vertical, horizontal or both.

The scrollable viewport is focusable, so keyboard users can scroll it with the arrow and page keys.

When to use

  • A long list or log inside a fixed-height panel.
  • A wide table or code block that should not change the page width.

When not to use

  • The whole page. The browser scrolls it already.

Guidelines

Do

  • Give the area a fixed height so it is clear it scrolls.
  • Give the region a label when it contains a list the user needs to find.

Don't

  • Do not nest scroll areas. Two scrollbars confuse users.

Accessibility

Roles and attributes

ElementRoleNotes
host—A scrollable wrapper. Add a label or heading so the purpose is clear.

Keyboard

KeysAction
Arrow keys, PageUpPageDown, HomeEndScroll the region once it has focus.
  • Make sure the content is reachable by keyboard. Focusable items inside should scroll into view.

API

ScrollArea

Selector: mui-scroll-area

NameTypeDefaultDescription
orientation'horizontal' | 'vertical' | 'both''vertical' Which axes scroll: `vertical`, `horizontal` or `both`. Default `vertical`.

CSS parts

  • ::part(root)
  • ::part(viewport)

Tokens

  • --mui-color-border
  • --mui-color-focus-ring
  • --mui-radius-md