Chip
A 24px pill token for modes, context files and attachments, optionally removable.
import { Chip } from "@arcadia/ui"A 24px token for what someone put in the composer: the mode chip (Plan), context files and attachments. With onRemove it ends in a 16px remove button in the chip's colour, with its own label and tooltip; remove one above and the rest close up. active draws the icon's filled form, for a chip that stands for a state that is on (a mode chip, a toggle chip that is pressed).
Chip or Badge? A chip is a token someone added and can take away. A Badge only states something, a count, a shortcut or a status, and can't be pressed.
Examples
rootStyle takes where the chip sits (margins, self-alignment, flex and grid placement, size bounds) and the knobs below, each a token of its kind. A colour, a raw length or any other property is a type error: a look that comes up twice becomes a variant.
| Knob | Takes | Default | Sets |
|---|---|---|---|
Paint | var(--fill-3) | Fill (the tone's wash). | |
Paint | var(--text-2) | Label colour, and the remove button's. | |
Paint | var(--icon-2) | Leading glyph colour. | |
Ref<Measure> | 240px | Width past which the label ellipsises. |
Tones only reassign the knobs. The remove button takes the chip's text colour, so a tone recolours it too.
The chip itself is a <span>; only its remove button is focusable, named by removeLabel (default "Remove"). Name it after what it removes ("Remove dialog.tsx") when several chips sit together, or every button reads the same.
Removing a chip takes its button out from under focus, so move focus somewhere sensible, such as the composer's text field or the next chip.
Chip
tone- "neutral" | "muted" | "accent" | "success" | "warning" | "danger" | "plan" | "ask" | "debug"Default"neutral"
- Shared by Badge and Chip. Mode tones (plan / ask / debug) tint at --mode-soft-strength.
icon- IconName
active- boolean
- The chip stands for a state that is on: its glyph draws the filled form. For a chip that exists only while its state holds (a mode chip) or a toggle chip that is pressed; never for an action.
onRemove- () => void
- Renders a trailing remove button (a 16px IconButton, "x", in the chip colour).
removeLabel- stringDefault"Remove"
- The remove button's label and tooltip.
removeHint- ReactNode
- Extra tooltip line for the remove button, e.g. the shortcut's effect.
rootStyle- ChipStyle
- Typed StyleX override: where the chip sits and its
--chip-*knobs. className- string
- A product's hook class for its own layout rules. Being retired: new code places a chip with
rootStyle; the call sites left are counted by ui.lint (kit-classname) and only go down.
Rest props go to <span> props and render.