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
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add scroll-area

Or install the full npm package:

npm install bigbullui

Usage

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 helper

Zero 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 />
PropTypeDescription
orientation"vertical" | "horizontal" | "both"Layout and keyboard navigation axis. (Default: "vertical")
scrollbarVisibility"always" | "hover" | "auto"Configures scrollbar visibility. (Default: "hover")
fadeShadowsbooleanToggles fade shadows. (Default: true)
notchedbooleanToggles notched. (Default: true)
showProgressbooleanToggles show progress. (Default: false)
viewportRef(node: HTMLDivElement | null) => voidConfigures viewport ref.
viewportClassNamestringConfigures viewport class name.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.
childrenReact.ReactNodeChild elements rendered inside the component.
onScroll(e: React.UIEvent<HTMLDivElement>) => voidCallback invoked on scroll.