separator.tsx 556 B

1234567891011121314151617181920212223242526
  1. import type { HTMLAttributes } from "react";
  2. import { cn } from "@/lib/utils";
  3. interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {
  4. orientation?: "horizontal" | "vertical";
  5. }
  6. export function Separator({
  7. className,
  8. orientation = "horizontal",
  9. ...props
  10. }: SeparatorProps) {
  11. return (
  12. <div
  13. role="separator"
  14. aria-orientation={orientation}
  15. className={cn(
  16. "shrink-0 bg-border",
  17. orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
  18. className,
  19. )}
  20. {...props}
  21. />
  22. );
  23. }