Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide "outline" token category #213

Open
VIPofJoy opened this issue Apr 12, 2023 · 5 comments
Open

Provide "outline" token category #213

VIPofJoy opened this issue Apr 12, 2023 · 5 comments

Comments

@VIPofJoy
Copy link

VIPofJoy commented Apr 12, 2023

"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
Copy link

lucijanblagonic commented Apr 19, 2023

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:

  • outline/border type (solid, dotted, dashed...)
  • outline/border width (1px, 2px...)
  • offset (1px, 2px...)
  • stacking multiple together
  • ...

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
Copy link
Author

VIPofJoy commented Apr 25, 2023

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

@VIPofJoy
Copy link
Author

{ "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
Copy link
Contributor

kevinmpowell commented May 17, 2023

Reviewed by Format Editors 5/17/23

  • Does this warrant revisiting the existing Border type? (to possibly make it more flexible, renaming to "Stroke"?)
  • Is "Outline" something that makes sense beyond the web platform? How about iOS & Android?
  • Possibly related to #98

@danosek
Copy link

danosek commented May 30, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants