Chip

Chip

A compact element for displaying labels, tags, categories, or selectable items with support for icons, avatars, and close actions.


Import

tsx
import { Chip } from "asheeui";

Usage

tsx
import { Chip } from "asheeui";
export default function Basic() {
return <Chip>Chip</Chip>;
}

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

UserJohn Doe

With dot indicator

Available
Custom color

Closable

Closable

Custom close icon

Custom close

Interactive (clickable)

Click me

Combined example

Featured

Props

PropTypeDefaultDescription
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
isDisabledbooleanfalseDisables interaction
startIconReactNodeNoneIcon displayed before content
endIconReactNodeNoneIcon displayed after content
avatarReactNodeNoneAvatar displayed instead of start icon
dotboolean | stringNoneShows a dot indicator (string = custom color)
onClose(e: MouseEvent<HTMLButtonElement>) => voidNoneCallback when close button is clicked
closeIconReactNodeCloseIconCustom close icon
childrenReactNodeNoneChip content
classNamestringNoneExtra 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:

  1. Instance prop: set directly on <Chip />
  2. Component config: components.chip in your ashee.config
  3. Theme default: defaultVariant / defaultColor / defaultRadius in your ashee.config
  4. Built-in fallback: component's internal default values

Component config

ts
// ashee.config.ts
import type { ExternalConfig } from "asheeui";
export const config: ExternalConfig = {
components: {
chip: {
variant: "solid",
color: "primary",
size: "md",
radius: "full",
},
},
};

Built-in fallbacks

ts
{
size: "md",
variant: "bordered",
color: "primary",
radius: "full",
className: "",
}

Accessibility

  • Renders a native <div> with tabIndex={0} for keyboard navigation when clickable
  • Uses aria-disabled for disabled state
  • Close button includes aria-label="Remove chip"
  • Supports keyboard interaction with Enter and Space keys when clickable
  • Implements focus-visible rings for keyboard navigation

Notes

  • Clickable Chips: When onClick is provided, the chip becomes interactive with cursor and hover effects.
  • Close Button: The close button is only rendered when onClose is provided.
  • Avatar vs Start Icon: avatar takes precedence over startIcon when both are provided.
  • Dot Indicator: Can be a boolean (true uses current color) or a string (custom color value).
  • Variant: The underlined variant from the base variant system is automatically mapped to bordered for chips.
Previous

← Carousel

Next

DatePicker →