Borders draw the edges people rely on: where a field starts, where one card ends and another begins, where the keyboard is right now.
Most borders are 1 px. Thicker lines mean something: selected, focused, or a status to notice.
Border colours are colour tokens: color.border for dividers and cards, color.border.bold for the edges of inputs, checkboxes and selects. See Tokens.
The widths
border.width.default--bh-border-width-default1 pxInputs, secondary buttons, cards, tables and dividers.border.width.selected--bh-border-width-selected2 pxThe bar under a selected tab or beside a selected side navigation item, and the edge of a selected card. Pair with color.border.selected.border.width.focused--bh-border-width-focused2 pxThe focus ring. Pair with color.border.focus and state.focus.offset.border.width.accent--bh-border-width-accent4 pxA status or emphasis bar on one edge: rows with an error, callouts and quotes. Pair with a status or brand border colour.
Examples
border.width.default · 1 px
Inputs, default buttons, cards, tables and dividers.
border.width.selected · 2 px
The bar under a selected tab, the bar beside a selected side navigation item, and the edge of a selected card. Always with color.border.selected.
border.width.focused · 2 px
The focus ring, in color.border.focus, drawn 2 px outside the element (state.focus.offset). Draw it inside, at −2 px, when a box around the element would cut it off: menu items, table cells and tabs in a scroll area.
border.width.accent · 4 px
A status or emphasis bar on one edge: a table row with an error, callouts and quotes. Banners don’t use it; they use a tinted background (see Color usage). The box keeps its radius on all four corners and the bar follows the curve.
Use one radius for every control.
Width and colour go together
| Width | Colour | For |
|---|---|---|
border.width.default |
color.border or color.border.bold |
Edges and dividers |
border.width.selected |
color.border.selected |
Selected tab, side navigation item or card |
border.width.focused |
color.border.focus |
Keyboard focus |
border.width.accent |
color.border.danger, .warning, .success, .info or .brand |
Status and emphasis bars |
Don’t show a state with colour alone. Selected and focused also change the width.
Do and don’t
Mark the selected tab with a 2 px bar in the selected colour.
Use the 4 px accent for a selected tab. Accent is for status and emphasis.
Put the 4 px accent on one edge only.
Draw 4 px all the way round. The box shouts and the message gets lost.
Give cards a 1 px border. Selection adds the 2 px border.
Give every card a 2 px border. Nothing can show selection any more.
Code
.callout {
position: relative;
overflow: hidden;
border: var(--bh-border-width-default) solid var(--bh-color-border);
border-radius: var(--bh-radius-100);
}
.callout::before {
content: "";
position: absolute;
inset: 0 auto 0 0;
width: var(--bh-border-width-accent);
background: var(--bh-color-border-danger);
}
:focus-visible {
outline: var(--bh-border-width-focused) solid var(--bh-color-border-focus);
outline-offset: var(--bh-state-focus-offset);
}
Tokens
| Token | Value | Description |
|---|---|---|
--bh-border-width-default | 1px | 1 px. Inputs, secondary buttons, cards, tables and dividers. |
--bh-border-width-selected | 2px | 2 px. The bar under a selected tab or beside a selected side navigation item, and the edge of a selected card. Pair with color.border.selected. |
--bh-border-width-focused | 2px | 2 px. The focus ring. Pair with color.border.focus and state.focus.offset. |
--bh-border-width-accent | 4px | 4 px. A status or emphasis bar on one edge: rows with an error, callouts and quotes. Pair with a status or brand border colour. |
Related
- Radius: corner radius steps and the nesting rule.
- Interaction states: hover, pressed, selected and disabled.