Chip
A compact element for representing an input, attribute, or action.
Usage
The Chip component is used to represent attributes, tags, or actions in a compact form. It supports various styles, sizes, and can include leading/trailing icons or a dismiss button.
Chip Props
Prop | Type | Default |
---|---|---|
variant | "outline" | "filled" | "outline" |
size | "small" | "large" | "small" |
color | "neutral" | "accent" | "neutral" |
leadingIcon | ReactNode | - |
trailingIcon | ReactNode | - |
isDismissible | boolean | - |
onDismiss | () => void | - |
children | ReactNode | - |
className | string | - |
role | string | "status" |
ariaLabel | string | - |
Examples
Variant
Choose between outline and filled variants to match your design needs.
Size
The Chip component comes in two sizes:
small
: Compact size with less paddinglarge
: More spacious with increased padding
Color
Choose between neutral and accent styles to control the visual emphasis.
With Icons
Chips can include leading and trailing icons to provide additional context or actions.
Dismissible
Chips can be made dismissible by adding the isDismissible prop and an onDismiss handler.
Accessibility
The Chip component has some accessibility features:
- Uses semantic HTML elements
- Includes proper ARIA roles and labels
- Provides keyboard navigation support
- Makes decorative elements hidden from screen readers
- Ensures proper contrast ratios in all variants and states