Data display
Divider
Horizontal or vertical rule with an optional inline label.
Preview
or
Older
Prospects Companies Lists
import { Divider } from "@/components/ui/divider";
export default function Example() {
return (
<div className="flex w-full max-w-md flex-col gap-6">
<Divider />
<Divider label="or" />
<Divider label="Older" align="start" dashed />
<div className="flex h-8 items-center gap-4 text-base text-fg-secondary">
Prospects <Divider orientation="vertical" /> Companies <Divider orientation="vertical" /> Lists
</div>
</div>
);
}Installation
Components are copied into your project — no runtime package.
Create a
divider.tsxfile and paste the following code into it.src/components/ui/divider.tsximport type { ReactNode } from "react"; import { cx } from "@/utils/cx"; export interface DividerProps { orientation?: "horizontal" | "vertical"; /** Text or element shown in the line, e.g. "OR". */ label?: ReactNode; align?: "start" | "center" | "end"; dashed?: boolean; className?: string; } /** Separates content. Optional label sits in the line. */ export function Divider({ orientation = "horizontal", label, align = "center", dashed, className }: DividerProps) { const line = cx("border-line", dashed && "border-dashed"); if (orientation === "vertical") { return <div role="separator" aria-orientation="vertical" className={cx("w-0 self-stretch border-l", line, className)} />; } if (!label) return <div role="separator" className={cx("h-0 w-full border-t", line, className)} />; return ( <div role="separator" className={cx("flex w-full items-center gap-3 text-label text-[11px] text-fg-muted", className)}> {align !== "start" && <span className={cx("flex-1 border-t", line)} />} <span className="shrink-0">{label}</span> {align !== "end" && <span className={cx("flex-1 border-t", line)} />} </div> ); }Add the theme tokens and the
cxhelper from Installation if you haven’t yet, then update the import paths to match your project setup.