StartFoundationsComponentsContent

Scroll area

A scroll area is a box with a size limit whose content scrolls. Keyboard users can reach and scroll it, and its scrollbar matches the theme.

Stable Figma
OverviewUsageAPIAccessibility

1.4.0: Tables can pin their first column.

1.3.0: Date picker supports ranges.

1.2.0: Toasts stack and expand on hover.

1.1.0: Menus open submenus to the side.

1.0.0: First stable release.

<tk-scroll-area label="Release notes" fade style="max-block-size: 160px">
  <p>1.4.0: Tables can pin their first column.</p>
  <p>1.3.0: Date picker supports ranges.</p>
  <p>1.2.0: Toasts stack and expand on hover.</p>
  <p>1.1.0: Menus open submenus to the side.</p>
  <p>1.0.0: First stable release.</p>
</tk-scroll-area>

Anatomy

Part What it is
tk-scroll-area the element; you give it the size
default slot the content, anything
scroll part the scrolling box; one Tab stop while the content overflows

Size

The scroll area never picks a height. Limit it with height, max-height, or a flex or grid track. Without a limit it grows with its content and never scrolls.

Axis

Ada LovelaceGrace HopperAlan Turing Katherine JohnsonEdsger DijkstraBarbara Liskov
<tk-scroll-area label="Team" axis="horizontal">
  <div style="display: flex; gap: var(--space-8); inline-size: max-content">
    <tk-tag>Ada Lovelace</tk-tag><tk-tag>Grace Hopper</tk-tag><tk-tag>Alan Turing</tk-tag>
    <tk-tag>Katherine Johnson</tk-tag><tk-tag>Edsger Dijkstra</tk-tag><tk-tag>Barbara Liskov</tk-tag>
  </div>
</tk-scroll-area>
  • vertical (default): scrolls up and down; content that's too wide is clipped.
  • horizontal: scrolls sideways, for a strip of cards or a wide chart.
  • both: scrolls in every direction, for a diagram or a wide log.

Options

  • fade: fades the content at an edge while there is more beyond it, and the fade goes away at the end. Use it where a cut-off edge could look like the end of the content. Set its depth with --tk-scroll-area-fade-size.
  • gutter: reserves room for the scrollbar, so content doesn't shift when it starts to overflow. Systems with overlay scrollbars, such as macOS by default, reserve nothing.

The scrollbar is the browser's own, thin and colored from the theme. It looks slightly different on each system. On a dark or tinted surface, set its color with --tk-scroll-area-thumb-color.