separator.tsx 770 B

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