Componentnavigation2.49 KB gzipZero dependencies
Scroll Area
Custom styled scrollable container with customized dashed scrollbar track, thumb indicator, horizontal/vertical support, and perforated top/bottom shadow fades.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add scroll-areaOr install the full npm package:
npm install bigbulluiUsage
tsx5 lines
import { ScrollArea } from "@/components/ui/scroll-area"; <ScrollArea className="h-64 w-full"> <div>Long content with perforated scrollbar</div></ScrollArea>Source code
scroll-area.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxscroll-area.tsx489 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface ScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> { orientation?: "vertical" | "horizontal" | "both"; scrollbarVisibility?: "always" | "hover" | "auto"; fadeShadows?: boolean; notched?: boolean; showProgress?: boolean; viewportRef?: (node: HTMLDivElement | null) => void; viewportClassName?: string; className?: string; children: React.ReactNode; onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;} Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { ScrollArea } from "@/components/ui/scroll-area"; <ScrollArea />| Prop | Type | Description |
|---|---|---|
| orientation | "vertical" | "horizontal" | "both" | Layout and keyboard navigation axis. (Default: "vertical") |
| scrollbarVisibility | "always" | "hover" | "auto" | Configures scrollbar visibility. (Default: "hover") |
| fadeShadows | boolean | Toggles fade shadows. (Default: true) |
| notched | boolean | Toggles notched. (Default: true) |
| showProgress | boolean | Toggles show progress. (Default: false) |
| viewportRef | (node: HTMLDivElement | null) => void | Configures viewport ref. |
| viewportClassName | string | Configures viewport class name. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |
| children | React.ReactNode | Child elements rendered inside the component. |
| onScroll | (e: React.UIEvent<HTMLDivElement>) => void | Callback invoked on scroll. |