Scroll Area
weekendsuperhero-io-sistine/scroll-areaFreeComponent
Augments native scroll functionality for custom, cross-browser styling.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Weekendsuperhero-io/sistine/main/public/r/scroll-area.jsonSource
1"use client";23import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";4import * as React from "react";56import { type MaterialAxisProps, materialSurface, splitAxisProps } from "@/lib/material";7import { cn } from "@/lib/utils";89/* Role: bordered adaptive glass. */10const ROLE = {11 border: true,12};1314const ScrollArea = React.forwardRef<15 React.ElementRef<typeof ScrollAreaPrimitive.Root>,16 React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> &17 MaterialAxisProps & {18 variant?: "default" | "glass";19 }20>(({ className, variant = "glass", children, ...props }, ref) => {21 const [axes, rest] = splitAxisProps(props);22 /* Variant classes carry BEHAVIOR only; the surface comes from materialSurface. */23 const variants = {24 default: "relative overflow-hidden",25 glass: "relative overflow-hidden rounded-lg",26 };2728 const m = materialSurface(variant === "default" ? null : ROLE, axes);2930 return (31 <ScrollAreaPrimitive.Root32 ref={ref}33 data-slot="scroll-area"34 data-material={m?.["data-material"]}35 className={cn(m?.className, variants[variant], className)}36 {...rest}37 >38 <ScrollAreaPrimitive.Viewport39 data-slot="scroll-area-viewport"40 className="h-full w-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"41 >42 {children}43 </ScrollAreaPrimitive.Viewport>44 <ScrollBar />45 <ScrollAreaPrimitive.Corner />46 </ScrollAreaPrimitive.Root>47 );48});49ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;5051const ScrollBar = React.forwardRef<52 React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,53 React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>54>(({ className, orientation = "vertical", ...props }, ref) => (55 <ScrollAreaPrimitive.ScrollAreaScrollbar56 ref={ref}57 data-slot="scroll-area-scrollbar"58 orientation={orientation}59 className={cn(60 "flex touch-none select-none transition-colors",61 orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",62 orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",63 className,64 )}65 {...props}66 >67 <ScrollAreaPrimitive.ScrollAreaThumb data-slot="scroll-area-thumb" className="relative flex-1 rounded-full bg-border" />68 </ScrollAreaPrimitive.ScrollAreaScrollbar>69));70// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from weekendsuperhero-io/sistine
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | weekendsuperhero-io/sistine | Components | Free | 5 deps · 4 files | |
| Alertalert | weekendsuperhero-io/sistine | Components | Free | 3 deps · 4 files | |
| Alert Dialogalert-dialog | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Auto Foregroundauto-foreground | weekendsuperhero-io/sistine | Components | Free | no deps | |
| Avataravatar | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Badgebadge | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Breadcrumbbreadcrumb | weekendsuperhero-io/sistine | Components | Free | 5 deps · 4 files | |
| Buttonbutton | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files |
