Chip
A compact element for displaying labels, tags, categories, or selectable items with support for icons, avatars, and close actions.
Import
Usage
Examples
Color
Primary
Secondary
Success
Warning
Danger
Variant
Solid
Bordered
Faded
Ghost
Size
Small
Medium
Large
Radius
No radius
Extra Small
Small
Medium
Large
Extra Large
Full
Disabled
Disabled
With start icon
With icon
With end icon
With end icon
With avatar
John Doe
With dot indicator
Available
Custom color
Closable
Closable
Custom close icon
Custom close
Interactive (clickable)
Click me
Combined example
Featured
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "solid" | "ghost" | "bordered" | "faded" | "bordered"* | Visual style of the chip |
color | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "primary"* | Semantic color |
size | "sm" | "md" | "lg" | "md" | Size scale |
radius | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "full"* | Corner rounding |
isDisabled | boolean | false | Disables interaction |
startIcon | ReactNode | None | Icon displayed before content |
endIcon | ReactNode | None | Icon displayed after content |
avatar | ReactNode | None | Avatar displayed instead of start icon |
dot | boolean | string | None | Shows a dot indicator (string = custom color) |
onClose | (e: MouseEvent<HTMLButtonElement>) => void | None | Callback when close button is clicked |
closeIcon | ReactNode | CloseIcon | Custom close icon |
children | ReactNode | None | Chip content |
className | string | None | Extra classes, merged with internal styles |
* Falls back through Global Configuration if not set. See below.
Global Configuration
Chip reads defaults from four places, in this order of precedence:
- Instance prop: set directly on
<Chip /> - Component config:
components.chipin yourashee.config - Theme default:
defaultVariant/defaultColor/defaultRadiusin yourashee.config - Built-in fallback: component's internal default values
Component config
Built-in fallbacks
Accessibility
- Renders a native
<div>withtabIndex={0}for keyboard navigation when clickable - Uses
aria-disabledfor disabled state - Close button includes
aria-label="Remove chip" - Supports keyboard interaction with Enter and Space keys when clickable
- Implements
focus-visiblerings for keyboard navigation
Notes
- Clickable Chips: When
onClickis provided, the chip becomes interactive with cursor and hover effects. - Close Button: The close button is only rendered when
onCloseis provided. - Avatar vs Start Icon:
avatartakes precedence overstartIconwhen both are provided. - Dot Indicator: Can be a boolean (
trueuses current color) or a string (custom color value). - Variant: The
underlinedvariant from the base variant system is automatically mapped toborderedfor chips.