Tag
ProA small, static label for a status or category: Sold, Open now, Featured. Tonal, filled or outlined, in M3, success and warning colours. Not an M3 component (@windmorph/react-pro).
import { Tag, TagGroup } from '@windmorph/react-pro';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Props
Tag 13 props
The label: one or a few words.
tonal(a container colour),filled(strong) oroutlined(quietest).colortype"neutral" | "primary" | "secondary" | "tertiary" | "error" | "success" | "warning"default"neutral"The colour roles: M3's, plus the theme's success and warning.
sm20px,md24px,lg32px (a chip's height).round(a pill) orsquare(small corners from the shape scale by size), the core Button's shape names.The full name when the label is short ("M3E" for "Expressive"): screen readers hear it instead of the label, and it shows in a plain tooltip on hover, keyboard focus or a touch long press (the tag takes focus for it).
Truncates the label with an ellipsis past this width. While a string label is cut short, its full text shows in a plain tooltip on hover, keyboard focus or a touch long press (the tag takes focus for it); screen readers always hear all of it.
Ref to the tag's
<span>.A 6px dot in the colour's strong role, for live status ("Open now").
A decorative leading icon, sized by
size.
Classes for the tag; they win over the defaults via
cn().Classes for each part.
Inline styles for the root element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
TagGroup 5 props
Also accepts the root element's HTML attributes (id, data-*, event handlers).
Spec status
Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.
| Item | Status | Details |
|---|---|---|
| Variants: tonal, filled, outlined | Built | Variant · Variants |
| Colours: M3 roles plus success and warning | Built | Variant · Variants, Statuses |
Sizes and shapes: sm, md, lg, round or square | Built | Configuration · Sizes |
| A live-status dot and a leading icon | Built | Configuration · Statuses |
Short forms (fullLabel) and truncation (maxWidth), the full text in a tooltip | Built | Configuration · Short forms |
| Component tokens | Built | Use case · Tokens |
Variants: tonal, filled, outlined
BuiltVariant · Variants
Sizes and shapes:
Builtsm,md,lg, round or squareConfiguration · Sizes
A live-status dot and a leading icon
BuiltConfiguration · Statuses
Short forms (
BuiltfullLabel) and truncation (maxWidth), the full text in a tooltipConfiguration · Short forms
Component tokens
BuiltUse case · Tokens
M3 Expressive specs
- Shape
rounded-corner-full- Variants
tonal, filled, outlined
Theming & tokens
- Colours use M3's roles and the theme's success and warning roles. A test keeps every label at 4.5:1 in every theme, mode and contrast level.
- The tokens below are set on a tag or an ancestor; each tag carries
data-tokens="wm-tag"anddata-palette="<variant>-<color>"(withdata-colorholding the colour alone), so a value set on an outer tag never leaks into a nested one. Their defaults follow the tag's size, shape (square-cornerforshape="square"), variant and colour. - Its height is a minimum, so larger text makes it taller instead of spilling out.
tagTokensexports every size and colour role, for building on the tag in code.
| Variable | Default | Paints |
|---|---|---|
--wm-tag-height | 24pxVaries with size. | The minimum height, the 1px border included (20 / 24 / 32px by size); larger text makes it taller. |
--wm-tag-padding-inline | 8pxVaries with size. | Before and after the content (6 / 8 / 12px by size). |
--wm-tag-gap | 4pxVaries with size. | Between the dot or icon and the label (4 / 4 / 6px by size). |
--wm-tag-icon-size | 16pxVaries with size. | The leading icon (14 / 16 / 18px by size). |
--wm-tag-corner | var(--md-sys-shape-corner-full)Varies with shape. | The corners: full, or `square-corner` with `shape="square"`. |
--wm-tag-square-corner | var(--md-sys-shape-corner-small)Varies with size. | The corners of `shape="square"` (extra-small / small / small by size). |
--wm-tag-dot-size | 6px | The status dot. |
--wm-tag-container | var(--md-sys-color-surface-container-highest)Varies with palette. | The container (transparent when outlined), by variant and colour. |
--wm-tag-content | var(--md-sys-color-on-surface-variant)Varies with palette. | The label and icon, by variant and colour. |
--wm-tag-outline | transparentVaries with palette. | The 1px border (transparent unless outlined), by variant and colour. |
--wm-tag-dot | var(--md-sys-color-on-surface-variant)Varies with palette. | The status dot, by variant and colour. |