Skip to main content
Neighborhood Design System v5.0.0-rc.2

Focus

Focus tokens give every keyboard-focused element the same visible outline.

Use the focus tokens, --nbhd-focus-*, to give your own interactive elements the same keyboard focus outline as the components. Form fields draw a solid outline and everything else draws a dashed one, so use --nbhd-focus-control-outlineStyle for fields.

The outline color, --nbhd-color-focus-outline, changes with the brand. Components read it through the surface, so the outline stays visible on dark sections. In your own CSS, use --nbhd-context-color-focus-outline to get the same switch.

.tile:focus-visible {
  outline: var(--nbhd-focus-outlineWidth) var(--nbhd-focus-outlineStyle)
    var(--nbhd-context-color-focus-outline);
  outline-offset: var(--nbhd-focus-outlineOffset);
}

Properties

TokenCSS VariableValueUsed for
color.focus.outlinevar(--nbhd-color-focus-outline)#42a5f5Outline color. Components read it through the surface, so it switches to the inverse color on dark sections.
focus.outlineWidthvar(--nbhd-focus-outlineWidth)2pxOutline thickness. Points to border.width.emphasis.
focus.outlineStylevar(--nbhd-focus-outlineStyle)dashedOutline style for buttons, links, cards, carousels, checkboxes and radios.
focus.control.outlineStylevar(--nbhd-focus-control-outlineStyle)solidOutline style for form fields: input, select, textarea and range.
focus.outlineOffsetvar(--nbhd-focus-outlineOffset)2pxGap between the element and its outline.
focus.textDecorationvar(--nbhd-focus-textDecoration)underlineUnderline on the text of a focused card or carousel slide.
Esc
↑ ↓ to move↵ to open