Skip to main content

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​

PropTypeDefaultDescription
labelstringRequired. Chip text.
isSelectedbooleanfalseToggles between selected and unselected color scheme.
onPress() => voidWhen provided, makes the chip pressable.
onRemove() => voidWhen provided, renders a remove (✕) button.
removeIconTVajraIconComponentIcon shown in the remove button, when onRemove is set. Defaults to a plain ✕ glyph.
iconTVajraIconComponentLeading icon shown before the label.
avatarReactNodeLeading element (e.g. an Avatar) shown before the label, instead of icon.
isDisabledbooleanfalseDisables press interactions and dims opacity.
selectedBgTVajraColors'primary'Background color when selected.
selectedColorTVajraColors'textInverse'Text/icon color when selected.
unselectedBgTVajraColors'surfaceRaised'Background color when not selected.
unselectedColorTVajraColors'text'Text/icon color when not selected.
testIDstringTest identifier forwarded to the root container.