GUILD OF GLEKS UIv21.19.0

gog-divider

Divider

A rule between two regions — horizontal or vertical, solid, dashed or dotted, with an optional label running through it. There is no hasLabel input: the two forms are told apart by whether anything was actually projected.

Overview

Import the component and drop it into a template.

typescript
import { DividerComponent } from '@guildofgleks/ui';

@Component({
  // ...
  imports: [DividerComponent],
})

Basic usage — a horizontal rule between two blocks:

Above the rule.

Below it.

<p>Above the rule.</p>
<gog-divider />
<p>Below it.</p>

Examples

Variants

solid is the default; dashed and dotted read as weaker separations. Each is shown plain and with a label: with nothing projected the label collapses and the two halves of the rule meet as one line — the spacing around a label is its own padding for exactly that reason, so a plain divider has no notch in the middle.

variant="solid"

OR

variant="dashed"

OR

variant="dotted"

OR
<!-- With nothing projected the label collapses and the two halves meet as one line. -->
@for (variant of variants; track variant) {
  <p>variant="{{ variant }}"</p>
  <gog-divider [variant]="variant" />
  <gog-divider [variant]="variant">OR</gog-divider>
}

Labels

Anything projected into the divider becomes its label and the rule splits around it. Because it is content rather than a label input, it takes markup — a word, an icon, a gog-tag.

OR Shipping details New
<gog-divider>OR</gog-divider>
<gog-divider>
  <gog-icon name="info" />
  Shipping details
</gog-divider>
<gog-divider><gog-tag variant="info" size="xsm">New</gog-tag></gog-divider>
<gog-divider><gog-icon name="star" /></gog-divider>

Vertical

orientation="vertical" separates items along a row instead of stacking regions. It stretches to the height of a flex or grid parent that has one; --gog-divider-vertical-length is the floor when there is nothing to stretch to.

BoldItalicLinkUndoRedo
<div>
  <span>Bold</span>
  <span>Italic</span>
  <gog-divider orientation="vertical" />
  <span>Link</span>
  <gog-divider orientation="vertical" variant="dashed" />
  <span>Undo</span>
  <span>Redo</span>
</div>

Inset

Indents the rule from the leading edge by --gog-divider-inset-size, so it lines up with the text of a list whose rows start with an icon instead of cutting across the whole row. Between the items of a real <ul>, use a border on the item instead — see Accessibility.

Order placed Awaiting payment Preparing shipment
@for (step of steps; track step.label; let last = $last) {
  <span><gog-icon [name]="step.icon" /> {{ step.label }}</span>
  @if (!last) {
    <!-- Starts under the text, not under the icon. -->
    <gog-divider inset />
  }
}

Per-instance tokens

--gog-divider-color, --gog-divider-thickness and --gog-divider-spacing are read only if set, so one divider can be heavier, coloured or roomier without touching the theme.

Accent, 3px More room around it
<gog-divider />
<!-- Instance tokens: one divider heavier and coloured, without touching the theme. -->
<gog-divider style="--gog-divider-color: var(--gog-accent-color); --gog-divider-thickness: 3px">
  Accent, 3px
</gog-divider>
<gog-divider style="--gog-divider-spacing: 32px">More room around it</gog-divider>

Accessibility

role="separator" on the host, with its orientation stated and named by its label. The rule itself is aria-hidden.

  • Role — role="separator" and an aria-orientation matching orientation, so a screen reader announces the break rather than skipping it.
  • Name — a projected label is the separator's accessible name, through aria-labelledby on the host 21.15.0, rather than content inside a role whose children ARIA treats as presentational. Keep labels short: every one is announced as a name. A divider with nothing projected stays unnamed.
  • Keyboard — none. A separator is not focusable.
  • Where it belongs — between groups of controls, or sections a reader moves between. Between the rows of a real <ul> the list already says where each item ends; draw the line with a border on the item there.

API Reference

Inputs

NameTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Which way the rule runs. A vertical divider takes its length from --gog-divider-vertical-length unless its container stretches it.
variant'solid' | 'dashed' | 'dotted''solid'How the line is painted.
insetbooleanfalseIndents the rule from the leading edge by --gog-divider-inset-size, so it lines up with the text of a list whose rows start with an icon or avatar instead of cutting across the whole row.

Global Configuration

This component has no GOG_CONFIG entries of its own — every default is set per instance. See Global Configuration for what does apply app-wide.

Styling Tokens

Every CSS custom property the divider paints with. Override any of them — on a single instance, a subtree, or a theme — to restyle it. See the Theming guide for the full token-layering model, or the Theme Generator to tweak these live.

TokenDescription
--gog-divider-line-color / -line-thicknessThe rule itself.
--gog-divider-solid-style / -dashed-style / -dotted-styleThe border-style each variant maps to.
--gog-divider-block-spacing / -inline-spacingMargin around a horizontal and a vertical divider respectively.
--gog-divider-vertical-lengthFallback length for a vertical divider whose row has no height of its own.
--gog-divider-inset-sizeHow far the inset variant is indented from the leading edge.
--gog-divider-label-color / -label-font-size / -label-font-weight / -label-gapThe projected label and the gap punched in the rule around it.