Brand Guide

Components

State rules

Every control moves through the same states, drawn with the same tokens.

The rules

A control's border carries most of its state. It is the foreground colour at one of three strengths, and each state is one step along.

  • Rest. A 1px control-border-subtle border, 25% of foreground, on a card fill. Every control starts here.
  • Hover. The border steps up to control-border, 50%. Nothing fills and nothing moves. A selected item does not change on hover.
  • Focus. The border steps up again to control-border-strong, 75%. It shows for the keyboard only, and nothing is drawn outside the control.
  • Selected. primary. Small things fill with it and choice cards take a primary border. Selected has the patterns.
  • Invalid. A destructive border on the control, or on every option in a group, with a message under it. Errors has the patterns and the wording.
  • Disabled. The whole field at 50%, with the rest border and a muted fill, and no hover. A selected or on control keeps primary, so it still shows its value.
  • Read-only. Fields only. A muted fill, full-contrast text, a lock, and helper text saying where the value came from.

A new control that follows these rules fits the set.

Rest, hover and focus

Hover each control, then tab through them. The border is the only thing that changes.

Selected

Hover changes nothing here. Tab through to see the line each filled control draws inside its edge, and the doubled border on the card.

Invalid

The border is red at rest, on hover and on focus, where a 1px red inset doubles it. A switch never errors, so it is not here.

Disabled

Off and on for each control. The on ones keep their fill at 50%.

Read-only

No hover or focus change, and the text can be selected. Choices have no read-only state: show the answer as text, or use disabled if it must stay in the form.

From your LinkedIn profile.

Focus

Focus is always a darker 1px edge, and only for the keyboard (focus-visible). There is no halo: nothing is drawn outside the control, so focus never collides with a neighbour or a popover. How the edge is drawn depends on what the control already has. The class strings are in @dex/shared/styles/focus-ring.

  • Bordered controls take focusBorder: the border itself steps up to control-border-strong. Inputs, selects, checkboxes, radios, switches and chips.
  • Borderless things take focusRing: the same edge as a 1px inset ring, which sits where a border would and shifts nothing. Ghost and link buttons, tabs, accordion rows and calendar days.
  • Text with no padding round it takes focusOutline: a 1px outline 2px out, because an inset would cut into the letters. Inline links and collapsible section headers.
  • Filled things keep their primary edge and draw a 1px line in their foreground colour just inside it. A ticked box, a selected radio, chip or calendar cell, a switch that is on, and a solid button.
  • An invalid control keeps its red border, and a 1px red inset doubles it. Focus never hides an error.
  • A group wrapping a field, such as the file dropzone or the chat composer, takes focusBorderWithin: its border steps up while the field inside has focus. Buttons inside the group keep their own focusRing.
  • A choice card marks the card, not the radio or checkbox inside it. A selected card doubles its primary border with a 1px primary inset.
  • A slider marks the thumb, not the track. The thumb already has a primary edge, so a 1px primary inset doubles it.

Give an element one of these, not two.

Focus by kind of control

Tab through: a stepped border, an inset ring, an outline, a line inside a fill, and a doubled red border.

Text with no padding, like