Chip
A small, optionally removable tag for filters and selections.
Usage
Chip is a small, button-based pill for tags, attributes, filters, and removable tokens. It shares its look with Button (same variant palette) but comes in compact sm / md / lg heights. Make one removable with dismissible — it adds a close affordance and animates itself out when dismissed. Group several with ChipGroup to share variant / size and clear them all at once.
A Chip renders a native <button> by default. Swap the element with render (e.g. an <a> for a tag link), and reach for the shared variant palette to convey meaning.
Examples
Variants
variant sets the visual style, drawn from the same palette as Button — soft (default), outline, primary, secondary, and destructive.
Sizes
size scales the height, padding, text, and icon together — sm, md (default), or lg.
With an icon
Mark a leading or trailing icon with data-icon="start" or data-icon="end" so the chip reserves the right inner spacing — the same convention as Button.
Dismissible
Add dismissible to render a close (✕) affordance. Clicking the chip removes it with a blur-and-scale exit animation, then fires onDismiss once the animation finishes — the cue to drop it from your state.
Selectable filters
A chip is a button, so it's ready for selection UIs. Drive a selected state yourself and swap the variant (and a check icon) to show which is active; set aria-pressed so the toggle state is announced.
Chip group
ChipGroup lays chips out in a wrapping row and shares variant / size with every child through context (a chip can still override its own). Capture a ref to call clearAll(), which dismisses every removable chip — each animates out and fires its onDismiss.
As a link
Because chips are often navigable tags, you can render one as an <a> (or your router's Link) with the render prop while keeping the chip styling — the state is still exposed to a render callback.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior follows the same direction.
The chip's content, inner icon spacing, and the dismiss button all use logical properties, so they mirror to the start/end edges automatically. For setup details and caveats, see the RTL guide.
API reference
Chip
A compact pill. Renders a native <button> by default.
Also forwards every remaining native <button> prop (onClick, type, aria-*, ref, …). The render callback receives the chip state: { variant, size, dismissible }.
ChipGroup
A wrapping flex container that shares defaults with its chips and can clear them as a set.
Renders a <div> and forwards every other prop (id, aria-*, …). ChipGroupHandle is { clearAll: () => void }.
Accessibility
- A
Chipis a native<button>(or whatever you pass torender), so it's focusable and in the tab order, and Enter / Space activate it. - For a dismissible chip, the whole chip is the dismiss control;
closeLabelprovides ansr-onlyaccessible name for the action — set it to something specific like"Remove React". - For selectable chips, set
aria-pressedto expose the on/off state to assistive tech. disabledremoves the chip from the tab order and setsdata-disabledfor styling.- The dismiss exit animation is reduced to a simple fade when the user prefers reduced motion.