Scroll Area

A scrollable container with custom scrollbars and optional scroll shadow indicators.

Overview

The ScrollArea component provides a scrollable container with customizable scrollbars that match your design system. Built on Base UI primitives, it supports vertical, horizontal, and bidirectional scrolling with optional scroll shadow indicators that show users when more content is available.

Usage

import { ScrollArea, ScrollAreaContent } from "@tilt-legal/cubitt-components/primitives";
<ScrollArea className="h-72 w-48 rounded-md border">
  <ScrollAreaContent className="p-4">
    {/* Scrollable content */}
  </ScrollAreaContent>
</ScrollArea>

Examples

Horizontal Scroll

Scroll horizontally through content by setting orientation="horizontal".

Both Directions

Enable scrolling in both directions with orientation="both".

Vertical Scroll Shadow

Add scroll shadow indicators to show users there's more content to scroll. The shadow fades in/out based on scroll position.

Horizontal Scroll Shadow

Both Scroll Shadows

Custom Shadow Configuration

Fine-tune the scroll shadow appearance with custom size, gradient stop percentage, and opacity values.


API Reference

ScrollArea

The root scrollable container component.

PropTypeDefaultDescription
orientation"vertical" | "horizontal" | "both""vertical"Direction of scrolling.
scrollShadow"vertical" | "horizontal" | "both" | "none" | ScrollShadowAxisConfig | ScrollShadowSideConfig"none"Scroll shadow indicator configuration.
classNamestring-Additional CSS classes for the viewport.

ScrollShadowConfig

The base configuration object for individual shadow settings:

PropertyTypeDefaultDescription
sizestring"40px"Size of the shadow gradient (e.g., "40px", "100px").
stopPercentnumber0Percentage (0-100) where the solid color ends and fading begins.
stopOpacitynumber100Opacity (0-100) of the starting color before fading to transparent.
snapbooleanfalseWhen true, shadow appears at full size immediately instead of growing with scroll progress.

ScrollShadowObjectConfig

The object configuration allows flexible shadow setup with type-safe constraints:

  • Vertical axis: Use either vertical OR top/bottom (not both)
  • Horizontal axis: Use either horizontal OR left/right (not both)
  • Cross-axis mixing: You CAN mix vertical with left/right (different axes)
PropertyTypeDescription
verticalboolean | ScrollShadowConfigShortcut for top and bottom shadows.
horizontalboolean | ScrollShadowConfigShortcut for left and right shadows.
topboolean | ScrollShadowConfigTop shadow (cannot be used with vertical).
bottomboolean | ScrollShadowConfigBottom shadow (cannot be used with vertical).
leftboolean | ScrollShadowConfigLeft shadow (cannot be used with horizontal).
rightboolean | ScrollShadowConfigRight shadow (cannot be used with horizontal).

ScrollAreaContent

Container for the scrollable content.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the content.

ScrollBar

Custom scrollbar component (used internally, but can be customized).

PropTypeDefaultDescription
orientation"vertical" | "horizontal""vertical"Direction of the scrollbar.
classNamestring-Additional CSS classes for the scrollbar.

On this page