Chip
Chips are compact elements that represent an input, attribute, or action.
Overview
The catnip-chip component displays a compact label with an optional leading icon. It operates in two mutually exclusive modes:
- Removable (default): Displays a trailing remove button that emits a
removeevent when clicked. Useful for displaying tags or selected items that the user can dismiss (e.g. values picked from a dropdown or typed into an input). - Selectable: The chip wraps a visually-hidden native
<input type="checkbox">, making the entire chip a checkable option. Selection state is controlled withmodel-value/update:modelValue(orv-model). Use selectable chips to present a list of predefined filter options the user can check or uncheck. - Read-Only: Both removable and selectable chips can be set to a non-interactive, muted visual state using the
readonlyboolean. Remove buttons are hidden and checkbox interactions are prevented, but the chip remains focusable so screen readers can still announce its value.
Live example
Guidelines
- Mutually exclusive modes: Do not attempt to make a chip both selectable and removable. The component design requires you to choose one mode.
- Use removable chips to display items the user can dismiss (e.g. tags selected from a dropdown or values typed into an input). Do not pass
model-valueto removable chips — it has no effect and a dev-mode warning will be logged. - Use selectable chips to present predefined options the user can check or uncheck (e.g. filter categories). The chip uses a native checkbox internally, so consumers should treat it like any other checkbox-based selection control.