Skip to main content
Kobalte

Divider

Since v2.0.0@kobalte/core/dividerSourceSeparator

A thin line that groups content in lists and layouts, with optional content (e.g. text or an icon) rendered in the middle of the line.

Import

import { Divider } from "@kobalte/core/divider";
// or
import { Root } from "@kobalte/core/divider";

Features

  • Support for horizontal and vertical orientation.
  • Custom element type support via the WAI ARIA Separator role.
  • Support for children (text, icon, etc.) rendered in the middle of the line, using a pure CSS technique (no extra markup required).
  • inset prop exposed as a data-inset attribute so consuming CSS can shrink or stretch the line to align with surrounding content.

Anatomy

The divider consists of:

  • Divider: The root container for a divider.
<Divider />

Example

Content aboveContent below
export function BasicExample() {
return (
<div style={{ display: "flex", "flex-direction": "column", gap: "8px" }}>
<span>Content above</span>
<Divider class={style.divider} />
<span>Content below</span>
</div>
);
}
.divider {
border: none;
background-color: hsl(240 5% 84%);
}
.divider[data-orientation="horizontal"] {
height: 1px;
width: 100%;
}
.divider[data-orientation="vertical"] {
width: 1px;
height: 16px;
}
[data-theme*="dark"] .divider {
background-color: hsl(240 5% 26%);
}
.divider-with-text {
display: flex;
align-items: center;
color: hsl(240 4% 46%);
font-size: 14px;
}
.divider-with-text::before,
.divider-with-text::after {
content: "";
flex: 1;
border-top: 1px solid hsl(240 5% 84%);
}
.divider-with-text::before {
margin-right: 12px;
}
.divider-with-text::after {
margin-left: 12px;
}
[data-theme*="dark"] .divider-with-text::before,
[data-theme*="dark"] .divider-with-text::after {
border-top-color: hsl(240 5% 26%);
}

Usage

Vertical orientation

HomeAboutContact
import { Divider } from "@kobalte/core/divider";
import "./style.css";
function App() {
return (
<div class="row">
<span>Home</span>
<Divider orientation="vertical" class="divider" />
<span>About</span>
<Divider orientation="vertical" class="divider" />
<span>Contact</span>
</div>
);
}
.row {
display: flex;
align-items: center;
gap: 8px;
}
.divider {
border: none;
background-color: hsl(240 5% 84%);
}
.divider[data-orientation="vertical"] {
width: 1px;
height: 16px;
}

With text

A divider can wrap content (e.g. text or an icon) rendered in the middle of the line. This is a pure CSS technique: the root becomes a flex container and ::before/::after draw the lines on either side of the children.

Sign in with your emailContinue as guest
import { Divider } from "@kobalte/core/divider";
import "./style.css";
function App() {
return (
<div>
<span>Sign in with your email</span>
<Divider class="divider-with-text">or</Divider>
<span>Continue as guest</span>
</div>
);
}
.divider-with-text {
display: flex;
align-items: center;
color: hsl(240 4% 46%);
font-size: 14px;
}
.divider-with-text::before,
.divider-with-text::after {
content: "";
flex: 1;
border-top: 1px solid hsl(240 5% 84%);
}
.divider-with-text::before {
margin-right: 12px;
}
.divider-with-text::after {
margin-left: 12px;
}

API Reference

Divider

Divider is equivalent to the Root import from @kobalte/core/divider.

PropDescription
orientation'horizontal' | 'vertical'
The orientation of the divider. Defaults to horizontal.
inset'none' | 'context' | string
Shrinks or stretches the line based on the orientation. Sets the data-inset data attribute for styling.
childrenJSX.Element
Content (e.g. text or an icon) rendered in the middle of the line.
Data attributeDescription
data-orientation='horizontal'Present when the divider has horizontal orientation.
data-orientation='vertical'Present when the divider has vertical orientation.
data-inset='<value>'Present when the inset prop is set.

Rendered elements

ComponentDefault rendered element
Dividerdiv

Last updated: 11/28/26, 9:28 PM