Chip
Interactive inline element - selectable, dismissible, or linkable. A chip is a compact, labeled token that represents a filter choice, an applied selection, or a navigation shortcut. Each variant uses the most appropriate semantic element (checkbox, span + button, anchor) so chips work without JavaScript: checkboxes toggle, links navigate, and close buttons submit a form.
Usage
When to use
- To represent an applied filter a user can remove
- To present a compact, selectable option in a filter UI
- To surface a small navigational shortcut inline with content
When not to use
- For display-only labels - use badge
- For full-width calls to action - use button
- For a fixed set of exclusive options with clear labels - use a radio group or segmented button group
Do
- Use the correct semantic variant (selectable / dismissible / linkable) for the chip's purpose
- Keep chip labels short (one or two words ideal)
- Provide an explicit accessible name on the dismiss control for dismissible chips (e.g. "Dismiss CSS")
Don't
- Don't mix different chip variants in a single group without clear affordances
- Don't rely on color alone to show the selected state
- Don't use a chip for destructive global actions
API
Slots
| Slot | Required | Description |
|---|---|---|
content | Yes | Visible chip text. |
icon | - | Optional leading icon markup (typically inline SVG). |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | Enum: selectable, dismissible, linkable | selectable | Semantic variant. |
url | string | - | Target URL for linkable chips. |
name | string | - | Name attribute for the selectable chip input. |
value | string | - | Value attribute for the selectable chip input. |
is_checked | boolean | - | Checked state for the selectable chip. |
is_disabled | boolean | - | Disabled state for the selectable chip input. |
is_multiple | boolean | - | When true, the selectable chip uses a checkbox input (multi-select). When false, a radio input. |
dismiss_label | string | - | Accessible label for the dismiss button. Defaults to "Dismiss {content}". |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Classes
| Class | Capability | Default | Description |
|---|---|---|---|
.subtle | Emphasis | - | Lower emphasis; a muted, quieter weight. |
.neutral | Emphasis | Yes | Default emphasis; the standard weight at balanced contrast. |
.accent | Emphasis | - | Higher emphasis; a stronger, louder weight. |
.info | Intent | - | Informational message. |
.warning | Intent | - | Warning or caution. |
.danger | Intent | - | Error, destructive, or critical. |
.success | Intent | - | Confirmation or completion. |
.solid | Fill | - | Filled surface; background and border rendered. |
.outline | Fill | - | Bordered surface; transparent background. |
.ghost | Fill | - | No surface; text or icon only. |
.sm | Size | - | Small. |
.md | Size | Yes | Medium. |
.lg | Size | - | Large. |
.rounded | Shape | - | Rounded corners. |
.square | Shape | - | Sharp corners. |
.pill | Shape | - | Fully rounded ends. |
.animated | Motion | Yes | Honors the animations option. |
.still | Motion | - | Forces motion off regardless of the option. |
Attributes
| Attribute | Set by | Required | Description |
|---|---|---|---|
data-chip | Consumer | - | Marks a dismissible chip root; the dismiss behavior binds to marked chips that directly contain a dismiss button. |
data-close | Consumer | - | On a descendant button inside the chip, marks it as the dismiss trigger consumed by the close utility. |
Events
| Event | Direction | Description |
|---|---|---|
chip-dismiss | Emits | Fired on the chip element when its dismiss button is activated. detail.trigger is null when the close-dismiss it answers carried no detail of its own. Cancelable - calling preventDefault() blocks removal so a host application can run async work first. |
close-dismiss | Listens | Listened on the chip root. The close utility on a descendant dismiss button dispatches it; chip cancels the default close behavior to run its own dismiss event. |
Examples
Selectable
Toggleable chip backed by <input type="checkbox">.
Linkable
Chip rendered as <a> for navigation.
With icon
Chip with a leading icon.
Dismissible
A row of chips each carrying a close button, whose accessible name names the chip it removes.
Single filter group
Selectable chips backed by radio inputs, so choosing one clears the previous choice.
Multiple filter group
Selectable chips backed by checkbox inputs, so any number can be active at once.
Accessibility
- WCAG 2.2 AA
- Selectable chips expose native toggle semantics
- Dismissible chip dismiss buttons carry an accessible name including the chip text (e.g. "Dismiss CSS")
- Linkable chips are proper links and work without JS
- Selected state is communicated via the native
checkedattribute for checkbox/radio chips. Custom non-native controls that need to expose pressed/checked semantics usearia-pressedoraria-checkedinstead - Visible focus ring on every interactive variant
- Keyboard reachable and activatable by Enter/Space