Documentation / Layout
Divider
A separator line between two blocks of content, horizontal or vertical, solid, dashed or dotted, with an optional label.
Without a label, the component renders a native <hr>; with label, a div with role="separator" that frames the text between two lines. The colour and margins are Tailwind classes (color, spacing), the thickness a number of pixels. No hooks: the component renders on the server.
Examples
Basic usage
A one-pixel horizontal line, with a vertical my-4 margin by default.
import { Divider } from "@synertech/ui";
export function Basic() {
return (
<div className="text-sm">
<p>Informations personnelles</p>
<Divider />
<p>Préférences de notification</p>
</div>
);
}Line styles and thickness
variant picks the border style, thickness the thickness in pixels and color the colour class.
import { Divider } from "@synertech/ui";
export function Variants() {
return (
<div>
<Divider variant="solid" />
<Divider variant="dashed" thickness={2} />
<Divider variant="dotted" thickness={3} color="border-blue-500" />
</div>
);
}With a label
label sits inside the line; textAlign shifts it to the left or right.
import { Button, Divider } from "@synertech/ui";
export function WithLabel() {
return (
<div className="max-w-sm space-y-2">
<Button fullWidth>Se connecter avec un compte professionnel</Button>
<Divider label="ou" />
<Button fullWidth bgColor="bg-gray-100 hover:bg-gray-200" textColor="text-gray-800">
Recevoir un lien par e-mail
</Button>
<Divider label="Options avancées" textAlign="left" variant="dashed" />
</div>
);
}Vertical separator
With orientation="vertical", the line takes its parent’s height: place it in a flex container with a set height.
import { Divider } from "@synertech/ui";
export function Vertical() {
return (
<div className="flex h-6 items-center text-sm">
<a href="#profil">Profil</a>
<Divider orientation="vertical" spacing="mx-3" />
<a href="#facturation">Facturation</a>
<Divider orientation="vertical" spacing="mx-3" />
<a href="#securite">Sécurité</a>
</div>
);
}API reference
Components
import { Divider } from "@synertech/ui";Props — DividerProps
| Prop | Type | Default | Description |
|---|---|---|---|
color |
string |
"border-gray-300 dark:border-gray-700" |
|
label |
string |
— | |
orientation |
DividerOrientation |
"horizontal" |
|
spacing |
string |
— | |
textAlign |
DividerTextAlign |
"center" |
|
thickness |
number |
1 |
|
variant |
DividerVariant |
"solid" |
+ 278 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).
Types
type DividerOrientation = "horizontal" | "vertical"DividerTextAlign
Typetype DividerTextAlign = "left" | "center" | "right"DividerVariant
Typetype DividerVariant = "solid" | "dashed" | "dotted"