Actions and feedback
Chip
When to use
- You need a short filter, an action tag or a toggleable category.
- You need an optional counter next to a short label.
When not to use
- For an entity's status, use
StatusBadge; for a plain numeric marker, useBadge. - For several related options, use
ToggleGrouporSegmented. - Do not use
Chipfor a decorative tag with no action: it is a button.
Minimal example
<Chip selected={filters.includes("ready")} onClick={() => toggleFilter("ready")} count={12}>
Ready
</Chip>Public API
selecteddefaults tofalse;tonecolors only the selected chip.size:smormd;count={0}is shown,nullandundefinedare not.iconOnlyhides the visible label but keeps it for the screen reader;mobileIconOnlyhides the label only on screens narrower than 640 pixels (thesmbreakpoint).type="button"by default; nativebuttonattributes are passed to the element.
Accessibility and semantics
- Always pass
childrenfor the icon-only and mobile-only variants: it is the button's name. - Do not use color as the only signal — the state is conveyed by
aria-pressed. - See
src/components/actions/Chip.tsx,src/components/actions/Chip.stories.tsx.
TypeScript types
ChipProps
Prop
Type
Plus DOM attributes, such as value, onChange, disabled — 288 in total; the table does not repeat them.