Open Bug 2083001 Opened 1 month ago Updated 1 month ago

Audit usage of "type" and "variant" in our reusable components and standardize their meanings

Categories

(Toolkit :: UI Widgets, enhancement)

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

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

Flags: needinfo?(bgrant)

Here's the definition I ended up using;

type vs variant. Use type when 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). Use variant when 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 into type; we deliberately use variant there because those are styles, not categories.

Flags: needinfo?(bgrant)
You need to log in before you can comment on or make changes to this bug.