Skip to main content
Version: latest
Works everywhere

Chip works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/chip) — the library detects the runtime automatically.

Chip

Chip renders a compact, inline label. Common use cases include tags, status badges, filter pills, and selected-value indicators in form components.

Live demo →

Overview

import { Chip } from '@prokodo/ui/chip'

<Chip label="Published" color="success" variant="outlined" />
<Chip label="Draft" color="warning" onDelete={() => handleDelete()} />

Import

import { Chip } from "@prokodo/ui/chip"

CSS:

import "@prokodo/ui/chip.css"

Props

PropTypeDefaultRequiredDescription
labelReactNodeChip label text or node.
variant"filled" | "outlined""filled"Visual style variant.
colorVariants"primary"Color accent.
iconReactNodeIcon element rendered inside the chip.
onDelete(e: MouseEvent<HTMLButtonElement>) => voidDelete button handler; renders delete icon.
onClick(e: MouseEvent<HTMLDivElement>) => voidClick handler (makes chip interactive).
onKeyDown(e: KeyboardEvent<HTMLDivElement>) => voidKeyboard handler on chip wrapper.
classNamestringCSS class on root element.

See src/components/chip/Chip.model.ts for the full ChipProps type.


Design Tokens

Customise Chip via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-chip-radiusvar(--pk-radius-pill)Chip border radius
--pk-chip-bginheritResting chip background
--pk-chip-fgvar(--pk-color-fg)Resting chip text color (adaptive — white in dark mode)
--pk-space-xsVertical padding
--pk-space-smGap between label and icon/delete button
--pk-space-mdHorizontal padding
--pk-color-borderBorder color in neutral outlined state
--pk-timing-normalColor/shadow transition duration
--pk-color-surface-raisedDelete button background

Dark mode: The base chip text color is now var(--pk-color-fg), so color="inherit" chips are readable on both light and dark surfaces.
Clickable chips (onClick / onKeyDown) display a coloured ambient shadow matching their color prop; the shadow fades out on hover — identical to the Button coloured-shadow pattern.


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
1.4.1Use of Color (A)🔍 Manual reviewColor must not be the only means of conveying information (e.g. error states, required field markers).
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.5.8Target Size (Minimum) (AA)🔍 Manual reviewInteractive target areas must be at least 24 × 24 CSS pixels. Verify in the integrated product UI.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 3 jest-axe assertion(s) across 4 test file(s) · 1 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Chip in Storybook


Source

src/components/chip/Chip.model.ts