Usage
After setting up the CSS, apply dv-divider to an hr for a thematic break. Hide a purely decorative divider from assistive technology.
<hr class="dv-divider" /> Examples
Line styles and labels
The default is solid. Dashed and dotted styles work with both orientations. A direct label is centered by default. Label-start and label-end place it at an edge.
Archive
<div class="dv-grid dv-gap-150 dv-p-150 dv-appearance-paper" style="inline-size: 100%">
<hr class="dv-divider dv-divider--dashed" />
<div class="dv-divider dv-divider--dotted dv-divider--label-end">
<span class="dv-divider__label">Archive</span>
</div>
</div> Vertical divider
Use a flex row so the divider can stretch across its height. Give a meaningful vertical separator an explicit orientation.
Draft
Published
<div class="dv-flex dv-gap-150 dv-p-150 dv-appearance-paper">
<span>Draft</span>
<div class="dv-divider dv-divider--vertical" role="separator" aria-orientation="vertical"></div>
<span>Published</span>
</div> API reference
| Class or attribute | Behavior |
|---|---|
dv-dividerdv-divider--vertical | Horizontal by default. The vertical modifier changes the axis. |
dv-divider--soliddv-divider--dasheddv-divider--dotted | Choose one line style. |
dv-divider__labeldv-divider--label-startdv-divider--label-end | Optional direct label and its placement. Vertical labels use vertical writing. |
Customization
Set length on the divider itself. A horizontal rule consumes inline space and a vertical rule consumes block space.
| Property | Effect and defaults |
|---|---|
--dv-divider-length | Length along the divider axis. Defaults to auto. |
--dv-divider-thickness | Defaults to 1px. |
--dv-divider-color / --dv-divider-foreground-weight | Line color and its foreground mix. The default weight is 24%. |
--dv-divider-label-gap | Gap between the label and each line segment. Defaults to space-100. |