Chip
A chip component for displaying compact labels, tags, or removable items
Installation
Terminal
Import
Component.tsx
Basic
`Chip` is a compact, interactive component used for displaying information, selections, or actions.
Features:
- Can be selected, deselected, or removed
- Supports prefix and suffix elements (icons, avatars, etc.)
- Clickable for toggling selection or triggering actions
- Can be used in groups for multi-select scenarios
Usage:
- Use chips for tags, filters, selections, or compact actions
- Combine with prefix/suffix elements for richer context
- Use the `onRemove` prop to make chips removable
Best Practices:
- Keep chip labels concise
- Use icons or color indicators for additional meaning
- Ensure sufficient contrast and accessible focus indicators
Accessibility:
- Fully accessible to screen readers and keyboard users
- Removable chips provide accessible remove buttons
- Prefix and suffix elements should be decorative or have accessible labels if meaningful
Basic: Shows a simple, static Chip.
- Use for displaying a single tag or label.
Chip
Selected
Selected: Demonstrates a selectable Chip.
- Click to toggle selection state.
- Useful for filter chips or multi-select scenarios.
Chip
On Remove
OnRemove: Demonstrates removable Chips with selection.
- Chips can be selected/deselected and removed from the group.
- Useful for tag input, filter lists, or dynamic chip groups.
Chip 1
Chip 2
Chip 3
Prefix
Prefix: Demonstrates a Chip with a prefix element (e.g., icon, color dot).
- Use for status indicators, avatars, or icons before the label.
Chip
Suffix
Suffix: Demonstrates a Chip with a suffix element (e.g., icon).
- Use for actions, status, or icons after the label.
Chip
API reference
| ChipProps | Type | Default |
|---|---|---|
size | undefined |"default" |"medium" | - |
as | ElementType |undefined | - |
disabled | boolean |undefined | - |
selected | boolean |undefined | - |
onClick | ((e: MouseEvent<HTMLDivElement, MouseEvent>) => void) |undefined | - |
classNames | { closeButton?: string |undefined; prefix?: string |undefined; root?: string |undefined; suffix?: string |undefined; text?: string |undefined; } |undefined | - |
i18n | { chip: string; remove: string; } |undefined | - |
onRemove | ((e: MouseEvent<HTMLElement, MouseEvent>) => void) |undefined | - |
prefixElement | ReactNode | - |
suffixElement | ReactNode | - |
variant | undefined |"default" |"accent" |"success" |"rest" | - |
ref | ((instance: HTMLDivElement |null) => void) |RefObject<HTMLDivElement> |null |undefined | - |