01 · Foundations

Divider

orientation horizontal/vertical · align center/left

A 1px separator in the line color, horizontal or vertical, optionally with a centered label.

A line being drawn


.heex
<.divider />

orientation × align


center
left
vertical
.heex
<div class="flex flex-wrap items-center gap-2.5"><div class="flex-1"><.divider>center</.divider></div><div class="flex-1"><.divider align="left">left</.divider></div><.divider orientation="vertical" class="h-10" /><span class="text-xs text-muted">vertical</span></div>

Usage

<.divider />
<.divider label="ou continue com" />

Rules

  • Prefer space to a divider: use it when neighboring groups have the same visual weight.
  • In lists inside cards (plans, insights), the divider is the item's border-top, not an element.

API reference

Todos os function components, atributos, valores e slots que este componente cobre.

A 1px separator in the line colour, horizontal or vertical, with optional centred or left-aligned text.

<.divider />
<.divider>ou continue com</.divider>
<.divider align="left">Entrega</.divider>
<div class="flex items-center gap-2.5"><span>Day</span><.divider orientation="vertical" /><span>Month</span></div>

A horizontal divider without text is an <hr> 1px high in the line colour. With text it is a row of two lines around the text (align="center") or the text followed by one line (align="left"), the text being a small uppercase label. A vertical divider is a 1px column, 18px high unless you pass style="height:40px" or an h-* class. Styled only with Tailwind utilities.

<.divider>

Attr Type Default Values / notes
orientation :string "horizontal" horizontal, vertical
align :string "center" center, left - Where a horizontal divider's text sits.
label :string nil The text, as an attribute instead of the inner block.
class :any nil
style :string nil

Any other HTML/phx attribute goes to the root element.

Slots:

  • <:inner_block>