Chip
A compact element for a filter, an entered value such as a recipient, or a suggested action.Filter chips
Preview
Code
Showing: Vegetarian
Installation
Package
CLI (copy source)
pnpm
pnpm add @advui/corenpm
npm install @advui/coreUsage
import { Chip } from '@advui/core'
<Chip selected={vegan} onSelectedChange={setVegan}>Vegan</Chip> // filter chip
<Chip onRemove={() => remove(name)}>{name}</Chip> // input chip
<Chip icon={<CalendarIcon />} onPress={schedule}>Schedule</Chip> // action chipExamples
Input and action chips
Removable recipients, and suggested actions.Preview
Code
To
Ada Lovelace
Grace Hopper
Alan Turing
Suggested
API reference
Chip
| Prop | Type | Default | Description |
|---|---|---|---|
children required | ReactNode | — | The label. |
icon | ReactNode | — | Leading icon or avatar. |
selected | boolean | — | Makes it a filter chip that turns on and off; shows a check when on. Set it when you control the state. |
defaultSelected | boolean | — | A filter chip that manages its own state, and whether it starts on. |
onSelectedChange | (selected: boolean) => void | — | Called when a filter chip is turned on or off. |
onRemove | () => void | — | Makes it an input chip with a remove (×) button. |
removeLabel | string | “Remove {children}” | Accessible name of the remove button. |
onPress | () => void | — | Makes it an action (assist) chip. |
disabled | boolean | false | Not interactive. |
Accessibility
- Filter chips are toggle buttons:
aria-pressedon web, a toggle button with a checked state on iOS and Android. Group them with a labelledrole="group". - The selected state is shown by color and a check mark, not color alone.
- Input chips keep their text and a separate remove button named “Remove Ada Lovelace”, so the action is clear and has its own focus stop.
- After a remove button removes its chip, focus moves to the next input chip in the row, or the previous one after the last, on every platform (unless the app has moved it). Otherwise focus is lost with the chip, and TalkBack and VoiceOver start again from the top of the screen.
- A disabled chip still takes touches on iOS and Android, so TalkBack finds it by touch and reads it as disabled; it ignores presses.
- Action chips are buttons. Chips without an action are plain text.
| Key | Action |
|---|---|
| Tab | Moves between chips and remove buttons. |
| Enter / Space | Toggles a filter chip or runs the action. |
Responsive behavior
Chips keep one line; put them in a wrapping row (flexWrap="wrap").
Platform notes
Web
Pressable chips are native
<button> elements.iOS
Touch targets are extended to 44pt with hit slop.
Android
Filter chips are announced as toggle buttons. With
androidRipple (on in material()), presses show the native ripple.