separator.tsx 756 B

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