React Chip Component
Chip
Release candidate (RC)
This component is in the Release Candidate phase and its API is considered stable. Minor adjustments may still occur before the final release.
React Chip component for CoreUI lets you build compact, interactive labels, tags, filters, and selections with icons, avatars, remove buttons, and keyboard support.
Overview#
The CoreUI React Chip component lets you build compact, interactive UI elements for labels, tags, filters, and selections. Chips support icons, avatars, removal, keyboard navigation, and theme-aware styling.
Chips are similar to badges, but they have a single size and more defined visual styles useful for indicating state and selection.
- Chips are statically sized and do not scale with the parent element by default.
- Chips can have icons, avatars, and remove buttons.
- Chips can be active or disabled.
- Chips automatically gain focus when they are
selectableorremovable. - Chips support keyboard navigation and selection in their container.
See examples of all of this in action below.
When to use chips#
Use the React Chip component when you need:
- Multi-select filters in search or form interfaces
- Removable tags for selected items or applied filters
- Keyboard-navigable selection groups
- Compact status indicators with icon or avatar support
Basic chips#
Use CChip for standalone chips.
Outline chips#
Use variant="outline" to remove all background images and colors on any chip.
Chips with icons#
Wrap CIcon in a <span className="chip-icon"> to render a leading icon.
Chips with avatars#
Use .chip-img for an image-like avatar or combine CChip with CAvatar.
Variants#
Apply color variants to your chips. Chips are subtle by default as this allows for a clear themed active state.
Active state#
Add active to make chips use the solid appearance. This is useful for toggle-style chip selections.
Sizes#
Use size="sm" or size="lg" for different sizes.
Interactive chips#
Use selectable, removable, selected, and disabled to match the interactive chip examples from CoreUI.
Remove button#
If removable is enabled, the remove button is rendered automatically.
Keyboard behavior#
Chips support keyboard navigation when they are selectable and/or removable.
When a chip is focused#
Enter/Space: toggle selection whenselectableis enabledBackspace/Delete: close chip whenremovableis enabledArrowLeft: move focus to previous chipArrowRight: move focus to next chipHome: move focus to the first chip in the containerEnd: move focus to the last chip in the container
Mouse interaction#
- Click chip: toggle selection when
selectableis enabled - Click remove: close chip when
removableis enabled
API#
Check out the documentation below for a comprehensive guide to all the props you can use with the components mentioned here.