Separator
Separator with thoughtful defaults, semantic styling, and editable source.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/separator.jsonUse it
Scroll horizontally for long lines
"use client";
import { Badge } from "@/components/jez-ui/ui/badge";
import { Separator } from "@/components/jez-ui/ui/separator";
export default function Example() {
return (
<>
<div className="grid w-full max-w-sm gap-5">
<div className="flex justify-between">
<h3 className="text-xl">Your workspace</h3>
<Badge>Personal</Badge>
</div>
<Separator />
<div className="flex justify-between text-sm">
<span>Projects</span>
<span className="text-muted-foreground">12</span>
</div>
<div className="flex justify-between text-sm">
<span>Collaborators</span>
<span className="text-muted-foreground">4</span>
</div>
</div>
</>
);
}
Props & types
Scroll horizontally for long lines
React.ComponentProps<"div"> & { vertical?: boolean }Source
View 2 source files
registry/ui/separator.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Separator({
vertical = false,
className,
...props
}: React.ComponentProps<"div"> & { vertical?: boolean }) {
return (
<div
role="separator"
aria-orientation={vertical ? "vertical" : "horizontal"}
className={cn(
"bg-border",
vertical ? "w-px self-stretch" : "h-px w-full",
className,
)}
{...props}
/>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
Dependencies
clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.
Read the accessibility and performance guide →