Skip to content

Chips

Assist, suggestion, filter and input chips for compact actions and entries, in a chip set.

import { AssistChip, SuggestionChip, FilterChip, InputChip, ChipSet } from '@windmorph/react';

Props

By name or description, across the 92 props below

AssistChip 20 props

  • childrentype ReactNodeRequired

    The label.

  • elevatedtype booleandefault false

    surface-container-low at level 1 instead of an outline.

  • leadingIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Icon before the label (18px). Hidden from assistive tech.

  • outlinetype "strong" | "standard"default "standard"

    The flat chip's border: outline-variant, or strong (outline) for 3:1 contrast where nothing else shows the chip is interactive.

  • densitytype 0 | -1 | -2 | -3default 0

    Web density, 0 to -3: each step takes 4px off the chip's height (32px at 0, 24px at -2 and -3); its touch target stays 48px. Left out, the chip takes the density of the nearest ChipSet, ThemeProvider or ThemeScope. M3 asks for density to be the reader's choice rather than a default, so prefer setting it there, from a setting.

  • reftype Ref<HTMLButtonElement> | Ref<HTMLAnchorElement>

    Ref to the root element: the <button>, or the <a> with href.

  • disabledtype booleandefault false

    Disables the element: it can't be pressed or focused, and shows the disabled style.

  • valuetype string | number | readonly string[]

    The value a submit button sends with its form, under its name. On a toggle (toggle) it's a string naming the button in a selection group instead, required to take part in the group's selection.

  • draggedtype booleandefault false

    The element is being dragged (e.g. a card picked up to move it): sets data-dragged for the dragged state layer. A consumer's own data-dragged attribute counts too.

  • preventFocusOnPresstype booleandefault false

    Don't move focus to the element on press (set by menu triggers).

  • astype "button"default "button"

    The element rendered: a native <button>.

  • hreftype string

    Renders a link. Navigation goes through React Aria's RouterProvider when one is set.

Also accepts every <a> or <button> attribute.

SuggestionChip 19 props

  • childrentype ReactNodeRequired

    The label.

  • elevatedtype booleandefault false

    surface-container-low at level 1 instead of an outline.

  • leadingIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Icon before the label (18px). Hidden from assistive tech.

  • outlinetype "strong" | "standard"default "standard"

    The flat chip's border: outline-variant, or strong (outline) for 3:1 contrast where nothing else shows the chip is interactive.

  • densitytype 0 | -1 | -2 | -3default 0

    Web density, 0 to -3: each step takes 4px off the chip's height (32px at 0, 24px at -2 and -3); its touch target stays 48px. Left out, the chip takes the density of the nearest ChipSet, ThemeProvider or ThemeScope. M3 asks for density to be the reader's choice rather than a default, so prefer setting it there, from a setting.

  • reftype Ref<HTMLButtonElement>

    Ref to the root <button> element.

  • disabledtype booleandefault false

    Disables the element: it can't be pressed or focused, and shows the disabled style.

  • valuetype string | number | readonly string[]

    The value a submit button sends with its form, under its name. On a toggle (toggle) it's a string naming the button in a selection group instead, required to take part in the group's selection.

  • draggedtype booleandefault false

    The element is being dragged (e.g. a card picked up to move it): sets data-dragged for the dragged state layer. A consumer's own data-dragged attribute counts too.

  • preventFocusOnPresstype booleandefault false

    Don't move focus to the element on press (set by menu triggers).

  • astype "button"default "button"

    The element rendered: a native <button>.

Also accepts every <button> attribute.

FilterChip 24 props

  • childrentype ReactNodeRequired

    The label.

  • trailingIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Icon after the label, e.g. a dropdown arrow when the chip opens a menu. Hidden from assistive tech; the whole chip is the control. Not with onRemove.

  • elevatedtype booleandefault false

    surface-container-low at level 1 instead of an outline.

  • leadingIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Icon before the label (18px). Hidden from assistive tech.

  • outlinetype "strong" | "standard"default "standard"

    The flat chip's border: outline-variant, or strong (outline) for 3:1 contrast where nothing else shows the chip is interactive.

  • densitytype 0 | -1 | -2 | -3default 0

    Web density, 0 to -3: each step takes 4px off the chip's height (32px at 0, 24px at -2 and -3); its touch target stays 48px. Left out, the chip takes the density of the nearest ChipSet, ThemeProvider or ThemeScope. M3 asks for density to be the reader's choice rather than a default, so prefer setting it there, from a setting.

  • reftype Ref<HTMLButtonElement>

    Ref to the root <button> element.

  • disabledtype booleandefault false

    Disables the element: it can't be pressed or focused, and shows the disabled style.

  • valuetype string

    Identifies the button in a selection group; required to take part in its selection.

  • draggedtype booleandefault false

    The element is being dragged (e.g. a card picked up to move it): sets data-dragged for the dragged state layer. A consumer's own data-dragged attribute counts too.

  • preventFocusOnPresstype booleandefault false

    Don't move focus to the element on press (set by menu triggers).

  • selectedtype boolean

    Controlled selection. Ignored inside a selection group.

  • defaultSelectedtype boolean

    Initial selection when uncontrolled.

Events

  • onRemovetype (() => void)

    Adds a remove button after the label, a second focus stop named "Remove" + the label (M3: for medium and expanded windows). Backspace or Delete on the chip also calls it.

  • onSelectedChangetype ((selected: boolean) => void)

    Called with the new selection when the user toggles the button.

Text

  • labelstype Partial<ChipLabels>

    Words the chip announces, with English defaults. A LabelsProvider sets them for the whole app.

Also accepts every <button> attribute.

InputChip 14 props

  • childrentype ReactNodeRequired

    The label.

  • leadingIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Icon before the label (18px). Hidden from assistive tech.

  • avatartype ReactElement<unknown, string | JSXElementConstructor<any>>

    A 24px image before the label, with 12px corners (takes precedence over leadingIcon).

  • selectedtype boolean

    Shows the chip as selected (aria-pressed on its action).

  • outlinetype "strong" | "standard"default "standard"

    The flat chip's border.

  • densitytype 0 | -1 | -2 | -3default 0

    Web density, 0 to -3: each step takes 4px off the chip's height (32px at 0, 24px at -2 and -3); its touch target stays 48px. Left out, the chip takes the density of the nearest ChipSet, ThemeProvider or ThemeScope. M3 asks for density to be the reader's choice rather than a default, so prefer setting it there, from a setting.

  • disabledtype booleandefault false

    Disables the chip's action and its remove button.

  • reftype Ref<HTMLDivElement>

    Ref to the root element.

Events

  • onPresstype ((e: PressEvent) => void)

    The chip's action, e.g. editing the entry. Makes the chip's label part a button.

  • onRemovetype (() => void)

    Shows a remove button; also called on Backspace or Delete.

Text

  • labelstype Partial<ChipLabels>

    Words the chip announces, with English defaults. A LabelsProvider sets them for the whole app.

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

ChipSet 15 props

  • childrentype ReactNodeRequired

    The chips. Filter chips take part in the set's selection with a value.

  • selectionModetype "none" | "single" | "multiple"default "none"

    Filter chip selection: single (a radio group: selecting a chip clears the others) or multiple. With none, each chip keeps its own state.

  • selectedKeystype Iterable<Key>

    The selected chips' values (controlled).

  • defaultSelectedKeystype Iterable<Key>

    The chips selected at first (uncontrolled).

  • deselectabletype booleandefault true

    The last selected chip can be deselected, leaving none. false keeps at least one chip selected.

  • disabledtype booleandefault false

    Disables every chip in the set, whatever its kind and whether or not the set has a selection. A chip can't opt out, so keep one that must stay usable outside the set.

  • layouttype "wrap" | "scroll"default "wrap"

    wrap onto new rows, or one row that scrolls sideways (M3 suggests scrolling past two rows).

  • densitytype 0 | -1 | -2 | -3default 0

    Web density, 0 to -3, for the set and its chips: each step takes 4px off the chips (32px at 0, 24px at -2 and -3) and puts as much more between rows (16px at 0, 24px at -2 and -3), so rows stay 48px apart and every chip keeps a 48px touch target of its own. Left out, the set takes the density of the nearest ThemeProvider or ThemeScope; M3 asks for density to be the reader's choice, so prefer setting it there.

  • reftype Ref<HTMLDivElement>

    Ref to the root element.

Events

  • onSelectionChangetype ((keys: Set<Key>) => void)

    Called with the selected chips' values when the selection changes.

Text

  • aria-labeltype string

    Accessible name for the set of chips. Required unless aria-labelledby is set.

  • aria-labelledbytype string

    The id of the element that names the set. Required unless aria-label is set.

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

Tokens

M3's component tokens as CSS variables. Each is unset until you set it, on :root, a theme or any ancestor, and falls back to the default shown. The root carries data-variant (and data-size where it has sizes), which picks the variables that apply. See Component tokens in the Customisation guide.

Chips tokens (md-comp-assist-chip)
VariableDefaultPaintsCompose
--md-comp-assist-chip-container-shapevar(--md-sys-shape-corner-small)The corners.AssistChipTokens.ContainerShape
--md-comp-assist-chip-label-text-colorvar(--md-sys-color-on-surface)The label.AssistChipTokens.LabelTextColor
--md-comp-assist-chip-with-icon-icon-colorvar(--md-sys-color-primary)The leading icon.AssistChipTokens.IconColor
--md-comp-assist-chip-flat-outline-colorvar(--md-sys-color-outline-variant)The flat chip’s border (the strong outline keeps `outline`).AssistChipTokens.FlatOutlineColor
--md-comp-assist-chip-elevated-container-colorvar(--md-sys-color-surface-container-low)The elevated chip’s container.AssistChipTokens.ElevatedContainerColor
Chips tokens (md-comp-suggestion-chip)
VariableDefaultPaintsCompose
--md-comp-suggestion-chip-container-shapevar(--md-sys-shape-corner-small)The corners.SuggestionChipTokens.ContainerShape
--md-comp-suggestion-chip-label-text-colorvar(--md-sys-color-on-surface-variant)The label.SuggestionChipTokens.LabelTextColor
--md-comp-suggestion-chip-with-leading-icon-leading-icon-colorvar(--md-sys-color-primary)The leading icon.SuggestionChipTokens.LeadingIconColor
--md-comp-suggestion-chip-flat-outline-colorvar(--md-sys-color-outline-variant)The flat chip’s border (the strong outline keeps `outline`).SuggestionChipTokens.FlatOutlineColor
--md-comp-suggestion-chip-elevated-container-colorvar(--md-sys-color-surface-container-low)The elevated chip’s container.SuggestionChipTokens.ElevatedContainerColor
Chips tokens (md-comp-filter-chip)
VariableDefaultPaintsCompose
--md-comp-filter-chip-container-shapevar(--md-sys-shape-corner-small)The corners.FilterChipTokens.ContainerShape
--md-comp-filter-chip-unselected-label-text-colorvar(--md-sys-color-on-surface-variant)The label (and the check), unselected.FilterChipTokens.UnselectedLabelTextColor
--md-comp-filter-chip-selected-label-text-colorvar(--md-sys-color-on-secondary-container)The label and the check, selected.FilterChipTokens.SelectedLabelTextColor
--md-comp-filter-chip-with-leading-icon-unselected-leading-icon-colorvar(--md-sys-color-primary)The leading icon, unselected.FilterChipTokens.UnselectedLeadingIconColor
--md-comp-filter-chip-flat-unselected-outline-colorvar(--md-sys-color-outline-variant)The flat chip’s border, unselected (the strong outline keeps `outline`).FilterChipTokens.FlatUnselectedOutlineColor
--md-comp-filter-chip-flat-selected-container-colorvar(--md-sys-color-secondary-container)The flat chip’s container, selected.FilterChipTokens.FlatSelectedContainerColor
--md-comp-filter-chip-elevated-unselected-container-colorvar(--md-sys-color-surface-container-low)The elevated chip’s container, unselected.FilterChipTokens.ElevatedUnselectedContainerColor
Chips tokens (md-comp-input-chip)
VariableDefaultPaintsCompose
--md-comp-input-chip-container-shapevar(--md-sys-shape-corner-small)The corners.InputChipTokens.ContainerShape
--md-comp-input-chip-unselected-label-text-colorvar(--md-sys-color-on-surface-variant)The label (and an unselected leading icon), unselected.InputChipTokens.UnselectedLabelTextColor
--md-comp-input-chip-selected-label-text-colorvar(--md-sys-color-on-secondary-container)The label, selected.InputChipTokens.SelectedLabelTextColor
--md-comp-input-chip-unselected-outline-colorvar(--md-sys-color-outline-variant)The border, unselected (the strong outline keeps `outline`).InputChipTokens.UnselectedOutlineColor
--md-comp-input-chip-selected-container-colorvar(--md-sys-color-secondary-container)The container, selected.InputChipTokens.SelectedContainerColor

Spec status

Built to the M3 Expressive chips spec. Each item of its variants and configurations links to a live example; where the M3 Expressive column of the spec differs from the original M3 one, it wins.

  • Assist chip

    Built

    Variant · Assist suggestion

  • Filter chip

    Built

    Variant · Filter

  • Input chip

    Built

    Variant · Input

  • Suggestion chip

    Built

    Variant · Assist suggestion

  • Flat and elevated

    Built

    Configuration · Assist suggestion

  • Filter content

    Built

    Use case · Filter

  • Entries a person added

    Built

    Use case · Input

  • Density (web, chosen by the reader)

    Built

    Use case · Density

  • outline="strong"

    Extension

    Draws a flat chip's border in outline for 3:1 contrast, as the spec's accessibility guidance asks where nothing else shows the chip's edge.

  • ChipSet

    Extension

    One Tab stop with arrow keys, a shared selection for filter chips, and a scroll layout that keeps one row.

Bundle size

Gzipped, as published: the component and the library code it imports. React, React Aria, Motion and the other dependencies aren't counted, and your bundler's minifier makes it smaller still. CI fails a change that grows it past its budget.

  • AssistChip, SuggestionChip, FilterChip, InputChip: 20.6 kB
  • ChipSet: 13.9 kB

M3 Expressive specs

Shape
rounded-corner-small
Variants
assist, suggestion, filter, input

Spec values

  • 32px tall (a minimum: a chip grows with a large browser font size) with a 48px touch target, 8px corners for every chip type, label-large, 18px icons, 24px avatars with 12px corners.
  • 16px at an edge without an icon (12px on an input chip), 8px beside one (4px beside an avatar), 8px between elements and between chips. Padding counts from the chip's edge: a flat chip's 1px border takes none of it, so flat and elevated chips are the same size.
  • Elevation never shows a press: an elevated chip rises from level 1 to 2 on hover and a selected flat filter chip from 0 to 1, only while it isn't pressed or keyboard-focused. A keyboard-focused flat chip's border darkens to on-surface (assist, suggestion) or on-surface-variant (filter, input).
  • Leading icons are primary, except a selected filter chip's (on-secondary-container) and an input chip's until it is selected (on-surface-variant). Selected filter and input chips are secondary-container with no border.
  • The remove button has a 48px target, and a chip with one is at least 88px wide, as M3 asks. Beside a toggle or an action the target is 41px wide: it stops where the label ends, so a press on the label is never taken for the remove button.
  • A selected InputChip without onPress has no aria-pressed to carry its state, so it says it in words (labels.selected, “Selected”): the remove button's description, or hidden text on a static chip.
  • Without a leading icon, a selected filter chip grows a check and its start padding moves 16 → 8px.
  • Only filter chips take a trailing icon (trailingIcon); input chips end with their remove button, and assist and suggestion chips have none.