Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

Outlines

Outline

The outline shorthand property sets all the outline properties in one declaration.

The outline property may be specified using one, two, or three of the values listed below. The order of the value does not matter. See outline in MDN for more details.

Note: The outline will be invisible if its style is not defined. This is because the style defaults to none. A notable exception is input elements, which are given default styling by browsers.

Values

<outline-color> Sets the color of the outline. Defaults to currentcolor if absent.

<outline-style> Sets the style of the outline. Defaults to none if absent.

<outline-width> Sets the thickness of the outline. Defaults to medium if absent.

Nonnegative length

If the outline is a numeric value defined in the theme, the solid outline style will be applied as a shorthand for the outlineWidth and outlineStyle properties.

EDITABLE EXAMPLE

Keyword

thin, medium, and thick are keywords that indicate the outline width. You can use them in the outline property, but you have to set the outlineStyle property to solid as well.

Note: Because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. Nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document.

EDITABLE EXAMPLE

Borders vs. outlines

Borders and outlines are very similar. However, outlines differ from borders in the following ways:

  • Outlines never take up space, as they are drawn outside of an element's content.
  • According to the spec, outlines don't have to be rectangular, although they usually are.