Chip
A compact, pressable label used for selection, filtering, or tagging, with optional selected state and remove action.
Playground
<Chip
label="React"
isSelected
onPress={() => {}}
/>
Selectable
<Chip label="Selected" isSelected onPress={() => {}} />
<Chip label="Unselected" onPress={() => {}} />
<Chip label="Disabled" isDisabled onPress={() => {}} />
Removable
React
TypeScript
<Chip label="React" isSelected onRemove={() => {}} />
<Chip label="TypeScript" isSelected onRemove={() => {}} />
Custom remove icon
By default the remove button shows a plain ✕ glyph. Pass removeIcon to use a real icon instead: any component matching TVajraIconComponent.
React
import { XIcon } from '@88khp/vajra-icons';
<Chip label="React" isSelected onRemove={() => {}} removeIcon={XIcon} />
With icon
Pass icon for a leading icon, or avatar for any custom leading element (e.g. an Avatar).
<Chip label="TypeScript" icon={SomeIcon} onPress={() => {}} />
Custom colors
<Chip
label="Custom"
isSelected
selectedBg="success"
selectedColor="textInverse"
onPress={() => {}}
/>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | Required. Chip text. | |
isSelected | boolean | false | Toggles between selected and unselected color scheme. |
onPress | () => void | When provided, makes the chip pressable. | |
onRemove | () => void | When provided, renders a remove (✕) button. | |
removeIcon | TVajraIconComponent | Icon shown in the remove button, when onRemove is set. Defaults to a plain ✕ glyph. | |
icon | TVajraIconComponent | Leading icon shown before the label. | |
avatar | ReactNode | Leading element (e.g. an Avatar) shown before the label, instead of icon. | |
isDisabled | boolean | false | Disables press interactions and dims opacity. |
selectedBg | TVajraColors | 'primary' | Background color when selected. |
selectedColor | TVajraColors | 'textInverse' | Text/icon color when selected. |
unselectedBg | TVajraColors | 'surfaceRaised' | Background color when not selected. |
unselectedColor | TVajraColors | 'text' | Text/icon color when not selected. |
testID | string | Test identifier forwarded to the root container. |