separator.tsx raw

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