<c-divider>
A separator: a thin line dividing groups of content, horizontal by default or vertical with `vertical`.
Usage
When to use
- Between groups of items in a
c-menu, slotted among itsc-menu-itemelements. Ac-menu-labelheads a group; the separator is the line between groups. - Between sections of a card or panel, or between items in a row.
- Not for spacing alone: it always draws a line.
Orientation
A horizontal separator is a block spanning the full width of its container,
with a small margin above and below. A vertical one is an inline-block with
a small margin on each side: in a flex row it stretches to the row's height,
and in running text it is at least 1em tall.
Accessibility
The line is a role="separator" element whose aria-orientation follows
vertical. It is not focusable; screen readers may announce it, which in a
menu marks the boundary between groups.
Customization
::part(root) is the line itself. It paints the divider token, a
translucent ink that reads on every surface in both theme modes, as its
background colour, so set background-color to recolour it and margin to
change its spacing:
c-divider::part(root) {
margin-block: 16px;
}
Examples
<template>
<div>
<p>Profile</p>
<c-divider />
<p>Preferences</p>
</div>
</template>
<template>
<div class="example-row">
<span>Details</span>
<c-divider vertical />
<span>Members</span>
<c-divider vertical />
<span>Settings</span>
</div>
</template>
API reference
<c-divider>
A separator: a thin line dividing groups of content, horizontal by default or vertical with `vertical`.
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
vertical | vertical | boolean | false | Render a vertical separator instead of the default horizontal one. |
CSS parts
Style from outside with c-divider::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The separator line element itself |