Loading...
Skip to main content

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.

  • Chip renders a span by default, matching Bootstrap's chip semantics. Use as="button" when the chip itself needs native button behavior.
  • Chips have one size—they don't scale with the parent font-size like 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 subtle and text theme tokens, while active state uses the bg and contrast tokens.
  • Native button chips can use the button's disabled state.
  • ChipInput supports 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.

Basic chip With avatar With iconDismissible
<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.

DefaultPrimaryAccentSecondarySuccessDangerWarningInfoDarkLightInverse
<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.

DefaultActiveDefaultActive
<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.

JavaScript TypeScript
<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.

ApprovedVerified
BugCritical
<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.

BugCritical
<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.

React
Press Enter or comma to add a skill.
<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.

Read only
<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:

NameTypeDefaultDescription
separatorstring | null','Character that triggers chip creation when typed. Set to null to disable.
allowDuplicatesbooleanfalseAllow duplicate chip values.
maxChipsnumber | nullnullMaximum number of chips allowed. null for unlimited.
placeholderstring''Placeholder text for dynamically created inputs.
dismissiblebooleantrueAdd dismiss buttons to created chips.
createOnBlurbooleantrueCreate 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

KeyAction
EnterCreate chip from current input value
, (or separator)Create chip from current input value
Backspace / DeleteWhen 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
EscapeClear selection, clear input, and blur

When a chip is focused

KeyAction
Backspace / DeleteRemove 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
HomeMove to first chip
EndMove to input
Cmd/Ctrl+ASelect all chips
EscapeClear selection and focus input

Mouse selection

ActionEffect
Click chipSelect chip (deselects others)
Cmd/Ctrl+ClickToggle chip in selection
Shift+ClickRange select from anchor to clicked chip

Accessibility

  • Associate ChipInputLabel with the chip input to provide an accessible name
  • Chips are focusable and support full keyboard navigation
  • Each ChipDismiss button has aria-label="Remove"
  • Selected chips have the .active class 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);
}
Documentation navigation
On this page
On this page