# Scroll Area

> Source: https://design.nanatec.co.ke/components/scroll-area/
> A scrolling region with slim scrollbars of its own, drawn over native scrolling so the wheel, touch and keyboard behave as they always do.

A scroll area keeps a long list or a wide row inside a fixed space, with scrollbars that
look the same on every system and stay out of the way until they are wanted. The
scrolling itself is the browser's own, so the wheel, a trackpad, touch, the keyboard and
find-in-page all work as people expect; only the scrollbars are drawn. For a whole page,
let the page scroll; use this for a panel, a list or a row inside it.

## Preview

## Installation

```html
<nana-scroll-area label="Recent claims" style="max-height: 18rem">
  <ul>
    <!-- … -->
  </ul>
</nana-scroll-area>
```

The `viewport` property is the element that scrolls, for reading or setting its scroll
position, and `--nana-scroll-area-scrollbar-size` sets how thick the scrollbars are.

## Orientation

`orientation` is `vertical` by default. Set `horizontal` for a row wider than its space,
as in the policy cards above, or `both` for a table or a canvas that runs both ways;
the two scrollbars then leave a corner between them.

## Scrollbars

`scrollbars` says when the scrollbars show:

| Value | Shows the scrollbars |
| --- | --- |
| `hover` | While the pointer is over the area, and while it scrolls. The default. |
| `scroll` | Only while it scrolls, fading out a moment after it stops. |
| `auto` | Whenever the content overflows. |
| `always` | Likewise; it never hides them while there is something to scroll. |

With nothing to scroll there is no scrollbar, whatever the setting. Dragging a thumb
scrolls, a press in a track jumps there, and a wheel over a scrollbar scrolls the content.

## Accessibility

- With something to scroll, the area joins the tab order, so keyboard users can focus it
  and scroll with the arrow keys, Page Up and Page Down, Home and End, and Space. With
  nothing to scroll it stays out of the way.
- Give it a `label` and screen readers announce it as a named region.
- The drawn scrollbars are hidden from screen readers; the content scrolls the way it
  always does for them.
- The scrollbars fade without motion when the reader prefers reduced motion.

## API
