Chip
Compact element for tags, filters and selected values, optionally removable.
Installation
bun add @xerobi/ui
import { Chip } from "@xerobi/ui/chip"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Default
Design
Active
Removable
import { Chip } from "@xerobi/ui/chip"
export function ChipDefault() {
return (
<div className="flex flex-wrap gap-2">
<Chip label="Design" />
<Chip label="Active" color="success" variant="soft" />
<Chip label="Removable" onDelete={() => {}} />
</div>
)
}Variants
| size | medium, small |
| variant | filled, soft, outlined |
| clickable | true, false |
API reference
Chip
| Prop | Type | Description |
|---|---|---|
| label | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | |
| color | "default" | "info" | "success" | "warning" | "secondary" | "primary" | "error" | |
| variant | "soft" | "filled" | "outlined" | |
| size | "small" | "medium" | |
| icon | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | |
| avatar | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | |
| disabled | boolean | |
| onDelete | (event: SyntheticEvent<Element, Event>) => void | Renders a remove button and calls this when it is pressed (or Backspace/Delete on the chip). |
| deleteIcon | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> |
Styling hooks: [data-slot="chip"].