Audit usage of "type" and "variant" in our reusable components and standardize their meanings
Categories
(Toolkit :: UI Widgets, enhancement)
Tracking
()
People
(Reporter: hjones, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [recomp])
In the course of exploring exporting our components for the web it came up that type and variant props are used to mean different things depending on the component. We should make an effort to standardize how we use these/give them consistent meanings.
Some of this work has already been done in the version of our components that were re-written for this repo, so we can use that as a reference point: https://github.com/mozilla/acorn-web-components
Updated•1 month ago
|
| Reporter | ||
Comment 1•1 month ago
|
||
Hey Benjamin I'm curious if you could provide some details on the direction you took here for acorn-web-components / what ended up changing compared to our Firefox components
Here's the definition I ended up using;
typevsvariant. Usetypewhen the value is a semantic category that carries meaning and maps to distinct affordances — an icon, a color, an ARIA/severity treatment — e.g.moz-message-bar(info/warning/success/error/critical),moz-badge(beta/new). Usevariantwhen the value is an interchangeable presentational or structural style with no semantic payload — e.g.moz-button(primary/destructive/ghost/muted),moz-card(accordion),moz-dialog(modal/inline). Firefox packs button styles intotype; we deliberately usevariantthere because those are styles, not categories.
Description
•