Scroll Area
jarvis-ui/scroll-areaFreeComponent
A scroll container with overlay scrollbars and automatic edge fades.
Live preview
live · rendered by the registry
Rendered by jarvis-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.jarv.is/r/scroll-area.jsonSource
1"use client";23import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";4import type * as React from "react";56import { cn } from "@/lib/utils";78type ScrollAreaProps = ScrollAreaPrimitive.Root.Props & {9 scrollFade?: boolean;10 scrollbarGutter?: boolean;11 hideScrollbar?: boolean;12 scrollRef?: React.Ref<HTMLDivElement>;13 contentRef?: React.Ref<HTMLDivElement>;14};1516function ScrollArea({17 className,18 children,19 scrollFade = true,20 scrollbarGutter = false,21 hideScrollbar = false,22 scrollRef,23 contentRef,24 ...props25}: ScrollAreaProps) {26 return (27 <ScrollAreaPrimitive.Root28 data-slot="scroll-area"29 className={cn("relative flex min-h-0 min-w-0 overflow-hidden", className)}30 {...props}31 >32 <ScrollAreaPrimitive.Viewport33 data-slot="scroll-area-viewport"34 ref={scrollRef}35 className={cn(36 "flex-1 rounded-[inherit] outline-none [scrollbar-width:none] focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 data-has-overflow-x:overscroll-x-contain [&::-webkit-scrollbar]:hidden",37 scrollFade &&38 "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] [--fade-size:1.5rem]",39 scrollbarGutter && "data-has-overflow-x:pb-2.5 data-has-overflow-y:pr-2.5",40 )}41 >42 <ScrollAreaPrimitive.Content data-slot="scroll-area-content" ref={contentRef}>43 {children}44 </ScrollAreaPrimitive.Content>45 </ScrollAreaPrimitive.Viewport>46 {!hideScrollbar && (47 <>48 <ScrollBar orientation="vertical" />49 <ScrollBar orientation="horizontal" />50 </>51 )}52 <ScrollAreaPrimitive.Corner data-slot="scroll-area-corner" />53 </ScrollAreaPrimitive.Root>54 );55}5657function ScrollBar({58 className,59 orientation = "vertical",60 ...props61}: ScrollAreaPrimitive.Scrollbar.Props) {62 return (63 <ScrollAreaPrimitive.Scrollbar64 data-slot="scroll-area-scrollbar"65 orientation={orientation}66 className={cn(67// … truncated
What it pulls in
npm packages
Files it writes
More from jarvis-ui
All 10 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Browser Windowbrowser-window | jarvis-ui | Components | Free | no deps | |
| Cookie Consentcookie-consent | jarvis-ui | Components | Free | no deps | |
| Copy Buttoncopy-button | jarvis-ui | Components | Free | 1 dep | |
| Copyable Fieldcopyable-field | jarvis-ui | Components | Free | no deps | |
| Parallax Cardparallax-card | jarvis-ui | Components | Free | 1 dep | |
| Stepperstepper | jarvis-ui | Components | Free | 1 dep | |
| Tipovertipover | jarvis-ui | Components | Free | 1 dep · 2 files | |
| Toasttoast | jarvis-ui | Components | Free | 2 deps |
