scroll-area.tsx
1,053 bytes
| 1 | 'use client'; |
|---|---|
| 2 | |
| 3 | import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'; |
| 4 | import * as React from 'react'; |
| 5 | import { cn } from '@/lib/utils'; |
| 6 | |
| 7 | const ScrollArea = React.forwardRef< |
| 8 | React.ElementRef<typeof ScrollAreaPrimitive.Root>, |
| 9 | React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> |
| 10 | >(({ className, children, ...props }, ref) => ( |
| 11 | <ScrollAreaPrimitive.Root ref={ref} className={cn('relative overflow-hidden', className)} {...props}> |
| 12 | <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]"> |
| 13 | {children} |
| 14 | </ScrollAreaPrimitive.Viewport> |
| 15 | <ScrollAreaPrimitive.Scrollbar |
| 16 | orientation="vertical" |
| 17 | className="flex touch-none select-none transition-colors h-full w-2 border-l border-l-transparent p-[1px]" |
| 18 | > |
| 19 | <ScrollAreaPrimitive.Thumb className="relative flex-1 rounded-full bg-border" /> |
| 20 | </ScrollAreaPrimitive.Scrollbar> |
| 21 | <ScrollAreaPrimitive.Corner /> |
| 22 | </ScrollAreaPrimitive.Root> |
| 23 | )); |
| 24 | ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName; |
| 25 | |
| 26 | export { ScrollArea }; |
| 27 | |