ChipA compact element for representing an input, attribute, or action.
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.
Install the component from your command line.
The
The Chip component comes in two sizes:
Choose between neutral and accent styles to control the visual emphasis.
Chips can include leading and trailing icons to provide additional context or actions.
Chips can be made dismissible by adding the isDismissible prop and an onDismiss handler.
The Chip component has some accessibility features:
DefaultAccent With IconDismissible
npm install @raystack/apsara
import { Chip } from '@raystack/apsara/v1' <Chip variant="outline" size="small">Label</Chip>
Chip
component accepts the following props:
variant
: Visual style variant ("outline"
|"filled"
, default: "outline")size
: Size of the chip ("small"
|"large"
, default: "small")style
: Color style ("neutral"
|"accent"
, default: "neutral")leadingIcon
: ReactNode to display as an icon before the labeltrailingIcon
: ReactNode to display as an icon after the labelisDismissible
: Boolean to show a dismiss button (replaces trailingIcon)onDismiss
: Callback function when dismiss button is clickedchildren
: Content to display inside the chipclassName
: Additional CSS class namesrole
: ARIA role for the chip (default: "status")ariaLabel
: Custom accessibility label for the chip
loading...
small
: Compact size with less paddinglarge
: More spacious with increased padding
loading...
loading...
loading...
loading...
- 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