Layout & Containers
Divider
A separator between content or layout regions. Supports text/icon labels, line styles, thickness and orientation.
Preview
Section titled “Preview”Above
Below
<div style="width: 100%">
<p style="margin: 0">Above</p>
<nana-divider></nana-divider>
<p style="margin: 0">Below</p>
</div> Installation
Section titled “Installation”The divider ships for all three targets. Pick the tab for your project — the CLI detects which you are on and serves the matching implementation.
npx @nana-tec/ui add dividerLands as src/components/ui/divider/divider.tsx, styled with Tailwind classes that
resolve to the design tokens. Requires Tailwind v4.
npx @nana-tec/ui add dividerLands in src/lib/components/ui/divider/ as Divider.svelte, styled with Tailwind
classes that resolve to the design tokens. Requires Tailwind v4.
Install the package for a versioned dependency:
npm install @nana-tec/ui-componentsOr copy the source in and own it:
npx @nana-tec/ui add dividerimport { Divider } from "@/components/ui/divider";
export function Example() { return ( <> <Divider /> <Divider label="or" /> <Divider variant="dashed" thickness="medium" /> </> );}With a label it renders a rule either side of the text; without one it is a
single rule. decorative drops the separator role for a divider that is
purely visual. orientation="vertical" stretches to its flex parent, so it
needs a sized row around it.
<script lang="ts"> import { Divider } from '$lib/components/ui/divider';</script>
<Divider /><Divider label="or" /><Divider variant="dashed" thickness="medium" />The label can also be a snippet for richer content:
<Divider> <Badge size="sm">New</Badge></Divider>decorative drops the separator role for a divider that is purely visual.
import "@nana-tec/ui-components/divider";<div style="width:100%"> <p style="margin:0">Above</p> <nana-divider></nana-divider> <p style="margin:0">Below</p></div>Classes you pass to the React and Svelte components are merged with
tailwind-merge, so an override wins rather than fighting. See
Using Tailwind.
Variants
Section titled “Variants”<div style="width: 100%">
<nana-divider variant="solid" thickness="medium"></nana-divider>
</div>
<div style="width: 100%">
<nana-divider variant="dashed" thickness="medium"></nana-divider>
</div>
<div style="width: 100%">
<nana-divider variant="dotted" thickness="medium"></nana-divider>
</div>
<div style="width: 100%">
<nana-divider variant="gradient" thickness="thick"></nana-divider>
</div> With a label
Section titled “With a label”<div style="width: 100%"><nana-divider>OR</nana-divider></div> Vertical
Section titled “Vertical”<div style="display: flex; align-items: center; height: 2rem; gap: 1rem">
<span>Left</span>
<nana-divider orientation="vertical"></nana-divider>
<span>Right</span>
</div> The React and Svelte props, read from the components’ own types:
Divider
| Prop | Type | Default |
|---|---|---|
orientation | DividerOrientation | 'horizontal' |
variant | DividerVariant | 'solid' |
thickness | DividerThickness | 'thin' |
label | ReactNode | |
inset | boolean | false |
decorative | boolean | false |
children | ReactNode |
Also accepts Omit<HTMLAttributes<HTMLDivElement>, 'children'>.
Divider
| Prop | Type | Default |
|---|---|---|
orientation | DividerOrientation | 'horizontal' |
variant | DividerVariant | 'solid' |
thickness | DividerThickness | 'thin' |
label | string | |
inset | boolean | false |
decorative | boolean | false |
children | Snippet |
Also accepts Omit<HTMLAttributes<HTMLDivElement>, 'class'>.
The attribute names, events and CSS hooks below are the Web Components reference.
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
decorative | decorative | boolean | false | Purely visual — removes the separator role from the a11y tree |
inset | inset | boolean | false | Pull the rule in from the edges |
label | label | string | undefined | — | Convenience text label (equivalent to slotting text) |
orientation | orientation | DividerOrientation | 'horizontal' | Line direction |
thickness | thickness | DividerThickness | 'thin' | Line thickness |
variant | variant | DividerVariant | 'solid' | Line style |
Slots
| Slot | Description |
|---|---|
(default) | Optional label content (text or an icon) centred in the rule |
CSS parts
| Part | Description |
|---|---|
::part(line) | The rule(s) |
::part(label) | The label wrapper |
CSS custom properties
| Property | Description |
|---|---|
--nana-divider-color | Line colour |
--nana-divider-thickness | Line thickness (overrides the thickness attribute) |
--nana-divider-gradient | Gradient (gradient variant) |
--nana-divider-label-color | Colour of the slotted label text |
| Slot | Description |
|---|---|
(default) | Optional label content (text or an icon) centred in the rule |
CSS Variables
Section titled “CSS Variables”| Variable | Description |
|---|---|
--nana-divider-color | Line colour |
--nana-divider-thickness | Line thickness (overrides the thickness attribute) |
--nana-divider-gradient | Gradient (gradient variant) |
CSS Parts
Section titled “CSS Parts”| Part | Description |
|---|---|
line | The rule(s) — two <hr> elements when a label is present |
label | The label wrapper |