Scroll Area

Scroll Area is a scrollable container with consistent, cross-browser custom scrollbars.

Tags

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

Installation

Nothing to add. This component ships as source in your download, so it is already in your project.

Filesrc/vui/scroll-area.tsx
Import from@viliha/vui-react/scroll-area

The exported names are at the top of that file. The import path is an alias the download's tsconfig.json points at src/vui/, so you can move that folder and change one line rather than every file that imports from it.

Usage

Give it a fixed height/width; content beyond it scrolls with a styled bar.

scroll-area-demo.tsx
import { ScrollArea } from "@viliha/vui-react/scroll-area";

export function Example() {
  return (
    <ScrollArea className="h-72 w-48 rounded-md border">
      {/* long content */}
    </ScrollArea>
  );
}

ScrollArea props

It takes no props of its own. Everything you pass reaches the underlying ScrollAreaPrimitive.Root primitive, so every attribute it accepts works here unchanged and nothing is invented on top.

ScrollBar props

It takes no props of its own. Everything you pass reaches the underlying ScrollAreaPrimitive.ScrollAreaScrollbar primitive, so every attribute it accepts works here unchanged and nothing is invented on top.