ScrollArea

Augments native scroll with a custom, cross-browser scrollbar so a fixed-height region (a long list, a code block, a wide table) scrolls inside a bounded box instead of growing the page. Reach for it when content has a known max size and you want a visible, consistent scrollbar across browsers. Prefer ScrollFade when you want a soft gradient edge cue rather than a visible bar, and skip both when the whole page should scroll natively. Add a horizontal ScrollBar as a child only when content overflows sideways; the vertical bar ships by default. Built on @radix-ui/react-scroll-area.

Vertical

Tags

v1.2.0-beta.50
v1.2.0-beta.49
v1.2.0-beta.48
v1.2.0-beta.47
v1.2.0-beta.46
v1.2.0-beta.45
v1.2.0-beta.44
v1.2.0-beta.43
v1.2.0-beta.42
v1.2.0-beta.41
v1.2.0-beta.40
v1.2.0-beta.39
v1.2.0-beta.38
v1.2.0-beta.37
v1.2.0-beta.36
v1.2.0-beta.35
v1.2.0-beta.34
v1.2.0-beta.33
v1.2.0-beta.32
v1.2.0-beta.31
v1.2.0-beta.30
v1.2.0-beta.29
v1.2.0-beta.28
v1.2.0-beta.27
v1.2.0-beta.26
v1.2.0-beta.25
v1.2.0-beta.24
v1.2.0-beta.23
v1.2.0-beta.22
v1.2.0-beta.21
v1.2.0-beta.20
v1.2.0-beta.19
v1.2.0-beta.18
v1.2.0-beta.17
v1.2.0-beta.16
v1.2.0-beta.15
v1.2.0-beta.14
v1.2.0-beta.13
v1.2.0-beta.12
v1.2.0-beta.11
v1.2.0-beta.10
v1.2.0-beta.9
v1.2.0-beta.8
v1.2.0-beta.7
v1.2.0-beta.6
v1.2.0-beta.5
v1.2.0-beta.4
v1.2.0-beta.3
v1.2.0-beta.2
v1.2.0-beta.1
<ScrollArea className="h-[240px] w-[220px] rounded-md border border-border">
  <div className="p-4">
    <h4 className="mb-3 text-base font-medium">Tags</h4>
    {tags.map((tag) => (
      <div key={tag}>
        <div className="text-base">{tag}</div>
        <Separator className="my-2" />
      </div>
    ))}
  </div>
</ScrollArea>

Horizontal

Photo by Ornella Binni
Photo by Ornella Binni
Photo by Tom Byrom
Photo by Tom Byrom
Photo by Vladimir Malyavko
Photo by Vladimir Malyavko
Photo by Annie Spratt
Photo by Annie Spratt
Photo by Hal Gatewood
Photo by Hal Gatewood
<ScrollArea className="w-[420px] rounded-md border border-border whitespace-nowrap">
  <div className="flex w-max gap-4 p-4">
    {photos.map((p) => (
      <figure key={p.artist} className="shrink-0">
        <div className="overflow-hidden rounded-md">
          <img src={p.src} alt={`Photo by ${p.artist}`} className="aspect-[3/4] h-[180px] w-[135px] object-cover" />
        </div>
        <figcaption className="pt-2 text-sm text-muted-foreground">
          Photo by <span className="font-medium text-foreground">{p.artist}</span>
        </figcaption>
      </figure>
    ))}
  </div>
  <ScrollBar orientation="horizontal" />
</ScrollArea>

Props

ComponentNotable props
ScrollAreaForwards all Radix ScrollArea.Root props. Owns the viewport + vertical ScrollBar.
ScrollBarorientation: "vertical" | "horizontal". Default "vertical". Render a horizontal bar as a child of ScrollArea to opt in.

Source

packages/react/src/components/scroll-area.tsx · Figma node 2819:29663