scroll-area
shadcn/scroll-areaFreeComponent
shadcn publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add scroll-areaSource
1"use client"23import * as React from "react"4import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"56import { cn } from "@/lib/utils"78const ScrollArea = React.forwardRef<9 React.ElementRef<typeof ScrollAreaPrimitive.Root>,10 React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>11>(({ className, children, ...props }, ref) => (12 <ScrollAreaPrimitive.Root13 ref={ref}14 className={cn("relative overflow-hidden", className)}15 {...props}16 >17 <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">18 {children}19 </ScrollAreaPrimitive.Viewport>20 <ScrollBar />21 <ScrollAreaPrimitive.Corner />22 </ScrollAreaPrimitive.Root>23))24ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName2526const ScrollBar = React.forwardRef<27 React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,28 React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>29>(({ className, orientation = "vertical", ...props }, ref) => (30 <ScrollAreaPrimitive.ScrollAreaScrollbar31 ref={ref}32 orientation={orientation}33 className={cn(34 "flex touch-none select-none transition-colors",35 orientation === "vertical" &&36 "h-full w-2.5 border-l border-l-transparent p-[1px]",37 orientation === "horizontal" &&38 "h-2.5 flex-col border-t border-t-transparent p-[1px]",39 className40 )}41 {...props}42 >43 <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />44 </ScrollAreaPrimitive.ScrollAreaScrollbar>45))46ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName4748export { ScrollArea, ScrollBar }
Files it writes
More from shadcn
All 62 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn | Components | Free | no deps | |
| alertalert | shadcn | Components | Free | no deps | |
| alert-dialogalert-dialog | shadcn | Components | Free | no deps | |
| aspect-ratioaspect-ratio | shadcn | Components | Free | no deps | |
| attachmentattachment | shadcn | Components | Free | no deps | |
| avataravatar | shadcn | Components | Free | no deps | |
| badgebadge | shadcn | Components | Free | no deps | |
| breadcrumbbreadcrumb | shadcn | Components | Free | no deps |
