Skip to contentKino
Skip to Content

Scroll area

A box that scrolls with thin scrollbars over its edge, which show while you use it, and edges that fade while there is more past them.

npx shadcn add https://kinoui.com/r/scroll-area.json
Share on

Examples

Activity

12 events

Default

Give it a height and it scrolls what is taller. Its scrollbar shows while the pointer is over it, and the bottom edge fades while there is more below.

Attachments

7 files

Horizontal

Content wider than the box scrolls sideways, with its bar along the bottom. Make the row as wide as its items with w-max.

Build log

Ready in 36s

Both ways

Content larger both ways scrolls both ways, with a bar on each side and every edge fading.

Installation

npx shadcn@latest add https://kinoui.com/r/scroll-area.json
Files
lib/reduce-motion.tslib/scroll.tscomponents/kino/scroll-area.tsx
Packages
@base-ui/react

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

Props

PropTypeDefaultDescription
aria-labelledbystringNoneThe id of the heading that names it, read out when it takes focus. Or name it with aria-label.
overflowEdgeThresholdnumber{ xStart, xEnd, yStart, yEnd }0How far, in pixels, it is scrolled from an edge before that edge counts as having more past it, for the data-overflow-* attributes.

Data attributes

AttributeOnDescription
data-has-overflow-yScrollAreaPresent while its content is taller than it. data-has-overflow-x does the same for wider.
data-overflow-y-endScrollAreaPresent while there is more below. -y-start is above, and -x-start and -x-end the start and end of a line.
data-scrollingScrollAreaPresent while it scrolls.

Accessibility

  • While its content is larger than it, the part that scrolls takes focus as a region, so the arrow keys, Page Up, Page Down, Home and End scroll it. Name it with aria-labelledby or aria-label. Content that fits leaves the tab order.
  • The scrollbars are hidden from screen readers, as the browser’s own are. You can drag a thumb or press the track to jump.
  • In forced colours the thumbs take the system’s text colour, so they stay visible.
  • The scrollbars only fade, so they look the same when the system asks for less motion.