separator.tsx
737 bytes
| 1 | 'use client'; |
|---|---|
| 2 | |
| 3 | import * as SeparatorPrimitive from '@radix-ui/react-separator'; |
| 4 | import * as React from 'react'; |
| 5 | import { cn } from '@/lib/utils'; |
| 6 | |
| 7 | const Separator = React.forwardRef< |
| 8 | React.ElementRef<typeof SeparatorPrimitive.Root>, |
| 9 | React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root> |
| 10 | >(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => ( |
| 11 | <SeparatorPrimitive.Root |
| 12 | ref={ref} |
| 13 | decorative={decorative} |
| 14 | orientation={orientation} |
| 15 | className={cn( |
| 16 | 'shrink-0 bg-border', |
| 17 | orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]', |
| 18 | className, |
| 19 | )} |
| 20 | {...props} |
| 21 | /> |
| 22 | )); |
| 23 | Separator.displayName = SeparatorPrimitive.Root.displayName; |
| 24 | |
| 25 | export { Separator }; |
| 26 | |