design-tokens / community-group

This is the official DTCG repository for the design tokens specification.
https://tr.designtokens.org
Other
1.56k stars 63 forks source link

Provide "outline" token category #213

Open VIPofJoy opened 1 year ago

VIPofJoy commented 1 year ago

"Outline" is different from "Border", in the design tool, its stroke is aligned to the outside. And it also supports offset, if the design tool does not support it, this ignores the value.

image
lucijanblagonic commented 1 year ago

Hi @VIPofJoy! To expand on this a bit as I've been doing a bit of work on focus outlines recently (I assume this is what you are showing) and specifically how to implement them in Figma.

There are 3 ways from what I have seen:

  1. Use strokes (borders) on an object (doesn't work on no-fill objects)
  2. Use Effect styles on an object (can stack multiple)
  3. Use an extra element positioned above the object (like your example)

There are also inset focus states, not just on the outside (dense UIs, or hidden overflow items like menus). And several ways how outlines can be implemented in code: you can use outline or even box-shadow. You might tend to use one over the other, depending on the flexibility, complexity of design, browser support or WCAG conformance you are aiming for (WCAG 2.2 Focus appearance).

With all that being said, focus outlines should support the following:

image Example of different focus styles (columns) across filled, outline and naked button (rows)

So my question at the end is, does this really require a separate category or is it simply a Composite token that takes multiple values?

VIPofJoy commented 1 year ago

Hi @lucijanblagonic! It be a composite token that accepts multiple values.

VIPofJoy commented 1 year ago

{ "focus": { "$type": "outline", "$value": { "color": "#00000080", "width": "4px", "style": "solid", "offset": "2px", } } } or { "focus": { "$type": "outline", "$value": { "color": "#00000080", "width": "4px", "style": "solid", } } } I am hesitating whether to make the offset attribute a new token category so that it can be used in various scenarios.

kevinmpowell commented 1 year ago

Reviewed by Format Editors 5/17/23

danosek commented 5 months ago

I like the Stroke. Figma and SVG use this term. In Figma, you can set the position.

Snímek obrazovky 2024-05-30 v 12 15 24

Are there any differences in CSS between border and outline beside outline-offset?