Chips
Small interactive elements representing entities like people, places, tags, or values. Combine with inputs for multi-value fields like skills, categories, or email recipients using themed chips.
Overview
Chips represent entities and can group or select values in forms and other interactive contexts. They're similar to the older Badges component, but have some meaningful differences.
Chiprenders aspanby default, matching Bootstrap's chip semantics. Useas="button"when the chip itself needs native button behavior.- Chips have one size—they don't scale with the parent
font-sizelike Badges. - Chips can have icons, avatars, and dismiss buttons.
- Chips can be themed, individually or as a group on the parent container. By default, chips use the
subtleandtexttheme tokens, while active state uses thebgandcontrasttokens. - Native button chips can use the button's disabled state.
ChipInputsupports keyboard navigation and selection, and gives its chips focus automatically.
See examples of all of this in action below.
Chips
Use Chip for each chip. It renders a span by default; set as="button" when the chip itself should be a button. Add ChipIcon for a leading icon, ChipImage for an image like an avatar, and ChipDismiss for a remove button. Dismiss buttons use the library’s Icon component and can be nested safely inside the default span.
<div className="d-flex flex-wrap gap-2">
<Chip>
Basic chip
</Chip>
<Chip>
<ChipImage
alt=""
height={16}
src="https://github.com/mdo.png"
width={16}
/>
{' '}With avatar
</Chip>
<Chip>
<ChipIcon
aria-hidden="true"
name="person-fill"
/>
{' '}With icon
</Chip>
<Chip>
Dismissible{' '}
<ChipDismiss
aria-label="Remove"
type="button"
/>
</Chip>
</div>Themed chips
Set theme to color your chips. Chips are subtle by default as this allows for a clear, themed active state.
<div className="d-flex flex-wrap gap-2">
<Chip>
Default
</Chip>
<Chip theme="primary">
Primary
</Chip>
<Chip theme="accent">
Accent
</Chip>
<Chip theme="secondary">
Secondary
</Chip>
<Chip theme="success">
Success
</Chip>
<Chip theme="danger">
Danger
</Chip>
<Chip theme="warning">
Warning
</Chip>
<Chip theme="info">
Info
</Chip>
<Chip theme="dark">
Dark
</Chip>
<Chip theme="light">
Light
</Chip>
<Chip theme="inverse">
Inverse
</Chip>
</div>Active state
Set active to make chips use the solid appearance (bg/contrast). This is useful for toggle-style chip selections.
<div className="d-flex flex-wrap gap-2">
<Chip theme="primary">
Default
</Chip>
<Chip
active
theme="primary"
>
Active
</Chip>
<Chip theme="success">
Default
</Chip>
<Chip
active
theme="success"
>
Active
</Chip>
</div>Chip input
Wrap Chip components and a FormGhost input in ChipInput to create a tag input field. The component enables JavaScript behavior automatically. Chips are grayscale by default, with primary blue for active states, but you can apply any theme color to the container so that chips within inherit the color of your choosing.
Type into the input below and press Enter or , to add new chips. Use the Backspace or Delete keys to remove chips. See the Keyboard behavior section for more details.
<ChipInput>
<ChipInputLabel htmlFor="skillsInput">
Skills:
</ChipInputLabel>
<Chip>
{' '}JavaScript{' '}
</Chip>
<Chip>
{' '}TypeScript{' '}
</Chip>
<FormGhost
id="skillsInput"
placeholder="Add more…"
type="text"
/>
</ChipInput>Theme variants
Set theme on ChipInput to apply a theme color to all chips within.
<Stack gap={3}>
<ChipInput theme="primary">
<Chip>
Approved
</Chip>
<Chip>
Verified
</Chip>
<FormGhost
placeholder="Add status..."
type="text"
/>
</ChipInput>
<ChipInput theme="danger">
<Chip>
Bug
</Chip>
<Chip>
Critical
</Chip>
<FormGhost
placeholder="Add issue"
type="text"
/>
</ChipInput>
</Stack>You can also individually apply a theme color to a chip with the chip’s theme prop.
<ChipInput theme="primary">
<Chip theme="warning">
Bug
</Chip>
<Chip theme="danger">
Critical
</Chip>
<FormGhost
placeholder="Add issue"
type="text"
/>
</ChipInput>Empty state
Start with just the ghost input—chips are created as users type.
<ChipInput theme="primary">
<FormGhost
placeholder="Type and press Enter"
type="text"
/>
</ChipInput>With label
Use a form label for better accessibility.
<FormField>
<FormLabel htmlFor="skillsInputLabel">
Skills
</FormLabel>
<ChipInput theme="primary">
<Chip>
React{' '}
<ChipDismiss
aria-label="Remove"
type="button"
/>
</Chip>
<FormGhost
id="skillsInputLabel"
placeholder="Add skill..."
type="text"
/>
</ChipInput>
<FormText>
Press Enter or comma to add a skill.
</FormText>
</FormField>Disabled
Disable the ghost input to prevent adding new chips, and disable the dismiss buttons on existing chips. Existing chips become non-interactive.
<ChipInput theme="primary">
<Chip>
Read only{' '}
<ChipDismiss
aria-label="Remove"
disabled
type="button"
/>
</Chip>
<FormGhost
disabled
placeholder="Disabled..."
type="text"
/>
</ChipInput>Usage
ChipInput initializes and disposes the plugin automatically. Pass options as props, and use onValuesChange to receive the current values.
Options
Pass options directly as ChipInput props:
| Name | Type | Default | Description |
|---|---|---|---|
separator | string | null | ',' | Character that triggers chip creation when typed. Set to null to disable. |
allowDuplicates | boolean | false | Allow duplicate chip values. |
maxChips | number | null | null | Maximum number of chips allowed. null for unlimited. |
placeholder | string | '' | Placeholder text for dynamically created inputs. |
dismissible | boolean | true | Add dismiss buttons to created chips. |
createOnBlur | boolean | true | Create chip from input value when the input loses focus. |
Keyboard behavior
Chip inputs support Mail.app-style keyboard navigation with chip selection.
When input is focused
| Key | Action |
|---|---|
Enter | Create chip from current input value |
, (or separator) | Create chip from current input value |
Backspace / Delete | When input is empty, select and focus last chip (first press); pressing again deletes it |
← | When cursor is at start, move focus to last chip |
Shift+← | Select last chip and extend selection |
Escape | Clear selection, clear input, and blur |
When a chip is focused
| Key | Action |
|---|---|
Backspace / Delete | Remove selected chips, then select and focus the next closest chip |
← | Move to previous chip |
→ | Move to next chip (or input if at end) |
Shift+← / Shift+→ | Extend selection in that direction |
Home | Move to first chip |
End | Move to input |
Cmd/Ctrl+A | Select all chips |
Escape | Clear selection and focus input |
Mouse selection
| Action | Effect |
|---|---|
| Click chip | Select chip (deselects others) |
Cmd/Ctrl+Click | Toggle chip in selection |
Shift+Click | Range select from anchor to clicked chip |
Accessibility
- Associate
ChipInputLabelwith the chip input to provide an accessible name - Chips are focusable and support full keyboard navigation
- Each
ChipDismissbutton hasaria-label="Remove" - Selected chips have the
.activeclass for visual indication - Chips are announced as they are added or removed
CSS
Chip variables
.example {
--bs-chip-height: 1.75rem;
--bs-chip-padding-x: 0.625rem;
--bs-chip-gap: 0.3125rem;
--bs-chip-border-radius: var(--bs-radius-pill);
--bs-chip-img-size: 1.25rem;
--bs-chip-icon-size: 1rem;
--bs-chip-dismiss-size: 1rem;
--bs-chip-dismiss-opacity: 0.65;
--bs-chip-dismiss-hover-opacity: 1;
--bs-chip-color: var(--bs-theme-fg, var(--bs-fg-body));
--bs-chip-bg: var(--bs-theme-bg-subtle, var(--bs-bg-2));
--bs-chip-border-color: transparent;
--bs-chip-selected-color: var(--bs-theme-contrast, var(--bs-primary-contrast));
--bs-chip-selected-bg: var(--bs-theme-bg, var(--bs-primary-bg));
--bs-chip-selected-border-color: var(--bs-theme-bg, var(--bs-primary-bg));
}
Chip input variables
These variables are scoped to the ChipInput container.
.example {
--bs-chip-input-padding-y: 0.75rem;
--bs-chip-input-padding-x: 0.75rem;
--bs-chip-input-gap: 0.375rem;
--bs-chip-input-ghost-min-width: 5rem;
--bs-control-fg: var(--bs-btn-input-fg);
--bs-control-bg: var(--bs-btn-input-bg);
--bs-control-border-width: var(--bs-border-width);
--bs-control-border-color: var(--bs-border-color);
--bs-control-border-radius: var(--bs-radius-5);
}