Skip to content

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

sizemedium, small
variantfilled, soft, outlined
clickabletrue, false

API reference

Chip

PropTypeDescription
labelstring | 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"
iconstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
avatarstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
disabledboolean
onDelete(event: SyntheticEvent<Element, Event>) => voidRenders a remove button and calls this when it is pressed (or Backspace/Delete on the chip).
deleteIconstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>

Styling hooks: [data-slot="chip"].

Search documentation

Search pages, components and blocks.