Chip
A compact pill for a filter, a choice or an entered value: selectable as a toggle, removable with a button or the keyboard.
c2-chip is the chip of Material, Mantine and antd: a small pill for a filter (“Status: Active”), a choice among a few options, or a value someone entered. On its own it is a read-only label. selectable makes it a toggle button: a click, Enter or Space flips selected, fires change and shows a check mark (the selected-icon slot replaces it, --c2-chip__selected-icon--display: none hides it). removable adds a remove button named “Remove” plus the chip’s text (remove-label changes the first word); it fires remove, and so do Backspace and Delete on a focused selectable chip. detail.value is the chip’s value, or its text when no value is set.
A chip can also read as a sentence made of c2-chip-part children, the filter chip of Linear and Airtable: Status | is any of | Active. The chip draws the parts side by side with a divider between them. interactive turns a part into a button that fires part-click with the part’s name. The event bubbles, so one listener on the chip opens the right editor for whichever part was clicked, anchored on event.target. haspopup and expanded describe that editor to assistive technology. Left and Right move between the interactive parts and the remove button, and Backspace or Delete on a part fires remove. Importing the chip registers c2-chip-part as well. A chip with parts is never a toggle.
The chip never removes itself: drop it from your own list in the remove handler, and move focus to its neighbour, so a framework-rendered list stays in sync. The prefix slot takes an icon or a small avatar. c2-badge stays the non-interactive status label; use a chip when people pick or dismiss it.
Import
import '@c2n/components/chip'