Scroll Area

Augments native scroll functionality for custom, cross-browser styling.

Examples

Default

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
<c-scroll-area scroll-area-classes="h-72 w-48 rounded-md border border-border">
  <div class="p-4">
    <h4 class="mb-4 text-sm font-medium leading-none">Tags</h4>
    <div class="text-sm">v1.2.0-beta.50</div>
    <div class="my-2 h-px bg-border"></div>
    <div class="text-sm">v1.2.0-beta.49</div>
    <div class="my-2 h-px bg-border"></div>
    <!-- ... more items -->
  </div>
</c-scroll-area>

Horizontal Scrolling

Set the orientation prop to "horizontal" to enable horizontal scrolling.

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 Drew Beamer
Photo by Drew Beamer
<c-scroll-area
  scroll-area-classes="w-96 rounded-md border border-border"
  orientation="horizontal"
>
  <div class="flex w-max space-x-4 p-4">
    <figure class="shrink-0">
      <div class="overflow-hidden rounded-md">
        <img
          src="https://images.unsplash.com/photo-1465869185982-5a1a7522cbcb?auto=format&fit=crop&w=300&q=80"
          alt="Photo by Ornella Binni"
          class="aspect-[3/4] h-fit w-[150px] object-cover"
        />
      </div>
      <figcaption class="pt-2 text-xs text-muted-foreground">
        Photo by
        <span class="font-semibold text-foreground">Ornella Binni</span>
      </figcaption>
    </figure>
    <!-- ... more figures -->
  </div>
</c-scroll-area>

API Reference

ScrollArea

Root container that provides a scrollable viewport with custom scrollbar(s).

Prop Type Default Description
orientation 'vertical' | 'horizontal' | 'both' 'vertical' The scroll direction(s) to enable
scroll-area-classes string - Additional CSS classes for the scroll area root

ScrollAreaScrollbar

Custom styled scrollbar track and thumb. Automatically rendered by ScrollArea.

Prop Type Default Description
orientation 'vertical' | 'horizontal' 'vertical' The scrollbar orientation
scroll-area-scrollbar-classes string - Additional CSS classes for the scrollbar track