Focus ​

Graupl provides a set of styles that make it easier to see which element has focus. By default, the styles apply when an element matches :focus-visible.

Example ​

Use Tab to move focus to the button and see the focus outline.

The .focus class applies the same styles. It changes the appearance without moving focus.

Custom Properties ​

The following custom properties can be used to customize the focus state:

PropertyDescriptionDefault Value
--graupl-focus-widthThe width of both the focus outline and box shadow.var(--graupl-border-width)
--graupl-focus-outline-colorThe color of the focus outline.var(--graupl-color)
--graupl-focus-outline-widthThe width of the focus outline.var(--graupl-focus-width)
--graupl-focus-outline-styleThe style of the focus outline.dotted
--graupl-focus-outlineThe outline applied in the focus state.var(--graupl-focus-outline-width) var(--graupl-focus-outline-style) var(--graupl-focus-outline-color)
--graupl-focus-outline-offsetThe offset of the focus outline.calc(-1 * var(--graupl-focus-outline-width))
--graupl-focus-box-shadow-colorThe color of the focus box shadow.var(--graupl-background)
--graupl-focus-border-colorThe color applied to the border in the focus state.var(--graupl-background)
--graupl-focus-box-shadowThe box shadow of the focus state.0 0 0 var(--graupl-focus-width) inset var(--graupl-focus-box-shadow-color)

Sass variables ​

The following Sass variables can be used to customize the generation of the focus state:

VariableDescriptionDefault Value
$focus-outline-styleThe style of the focus outline.dotted