Skip to content

Tag

Pro

A 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

By name or description, across the 18 props below

Tag 13 props

  • childrentype ReactNodeRequired

    The label: one or a few words.

  • varianttype "tonal" | "filled" | "outlined"default "tonal"

    tonal (a container colour), filled (strong) or outlined (quietest).

  • colortype "neutral" | "primary" | "secondary" | "tertiary" | "error" | "success" | "warning"default "neutral"

    The colour roles: M3's, plus the theme's success and warning.

  • sizetype "sm" | "md" | "lg"default "md"

    sm 20px, md 24px, lg 32px (a chip's height).

  • shapetype "round" | "square"default "round"

    round (a pill) or square (small corners from the shape scale by size), the core Button's shape names.

  • fullLabeltype string

    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).

  • maxWidthtype MaxWidth<string | number>

    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.

  • reftype Ref<HTMLSpanElement>

    Ref to the tag's <span>.

  • dottype boolean

    A 6px dot in the colour's strong role, for live status ("Open now").

  • icontype ReactNode

    A decorative leading icon, sized by size.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

TagGroup 5 props

  • childrentype ReactNodeRequired

    The tags.

  • reftype Ref<HTMLUListElement>

    The list element.

Text

  • aria-labeltype string

    Names the group for screen readers, e.g. "Job details".

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.

  • 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

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" and data-palette="<variant>-<color>" (with data-color holding 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-corner for shape="square"), variant and colour.
  • Its height is a minimum, so larger text makes it taller instead of spilling out.
  • tagTokens exports every size and colour role, for building on the tag in code.
Tag tokens
VariableDefaultPaints
--wm-tag-height24pxVaries with size.The minimum height, the 1px border included (20 / 24 / 32px by size); larger text makes it taller.
--wm-tag-padding-inline8pxVaries with size.Before and after the content (6 / 8 / 12px by size).
--wm-tag-gap4pxVaries with size.Between the dot or icon and the label (4 / 4 / 6px by size).
--wm-tag-icon-size16pxVaries with size.The leading icon (14 / 16 / 18px by size).
--wm-tag-cornervar(--md-sys-shape-corner-full)Varies with shape.The corners: full, or `square-corner` with `shape="square"`.
--wm-tag-square-cornervar(--md-sys-shape-corner-small)Varies with size.The corners of `shape="square"` (extra-small / small / small by size).
--wm-tag-dot-size6pxThe status dot.
--wm-tag-containervar(--md-sys-color-surface-container-highest)Varies with palette.The container (transparent when outlined), by variant and colour.
--wm-tag-contentvar(--md-sys-color-on-surface-variant)Varies with palette.The label and icon, by variant and colour.
--wm-tag-outlinetransparentVaries with palette.The 1px border (transparent unless outlined), by variant and colour.
--wm-tag-dotvar(--md-sys-color-on-surface-variant)Varies with palette.The status dot, by variant and colour.