Skip to content

Chip

In review
Live · web

Filter chips: toggle (cyan = selected)

Filter chip with a leading status dot

Removable input chips: press the ✕ (or focus it and hit Enter)

Disabled: inert, still visible

Removed 0 chips. The island is live.

// Web: React, consuming @dizyx/nockerl-tokens. (Web is the laggard platform; this is the
// canonical API the published @dizyx/nockerl-react package is intended to expose. It
// unifies both shipped idioms: `selected` for filtering, `onRemove` for removable tokens.)
import { NockerlChip } from '@dizyx/nockerl-react';
export function FilterStrip() {
const [active, setActive] = useState('sessions');
return (
<div className="chip-row">
{/* filter idiom: selected gets the cyan fill */}
<NockerlChip text="Sessions" selected={active === 'sessions'} onClick={() => setActive('sessions')} />
<NockerlChip text="Agents" selected={active === 'agents'} onClick={() => setActive('agents')} />
{/* input idiom, a removable token */}
<NockerlChip text="typescript" selected onRemove={() => removeTag('typescript')} />
</div>
);
}
PropTypeDefaultDescription
text *stringVisible label. Bound to the label type role.
selectedbooleanfalseWhether this chip is the active selection (filter idiom).
onClick() => voidToggle/tap handler. Ignored while disabled.
disabledbooleanfalseInert + clearly-seen (never invisible) state.
leadingIconstringOptional leading glyph (e.g. a status dot) before the label.
swatchstringA per-item COLOR swatch dot before the label (e.g. a chart series color). Unlike leadingIcon='dot' (which inherits the chip's currentColor), this paints an arbitrary fixed color, so a row of chips can each carry a distinct key color.
onRemove() => voidWhen set, renders a trailing x; invoked when it is pressed (input idiom).
tokenbooleanfalseTOKEN mode: render the chip as a NON-interactive <span> container (NOT a <button>), so a removable token can sit INSIDE another interactive element (e.g. a MultiSelect trigger <button>) without nesting a real <button> (the React #418 nested-button hydration bug fixed in Wave 1). The removable x stays its own span[role=button] control (a span, never a nested <button>). A token is a static tag + a remove, not a toggle, so selected / onClick / aria-pressed do not apply in this mode.

Also accepts the native <button> attributes (e.g. onClick, disabled, id, aria-*, data-*), forwarded straight through, plus a forwarded ref.

Cross-platform parity (published packages)

The published Compose (com.dizyx.nockerl.design.components) and Swift (NockerlDesign) NockerlChip now share the selectable idiom and the pill token, and the earlier drift is resolved:

  • Same idiom. Both native platforms ship the selectable chip (selected, no ✕). Swift’s old removable-only Chip is retired. The removable/tag chip is now a web-only capability.
  • Pill radius is tokenized. Swift consumes NockerlRadius.pill; Compose uses NockerlPillShape. Same fully-rounded silhouette from a shared token, no bare Capsule().
  • Disabled is honored. Swift dims via .disabled(_:) (environment); Compose via the explicit enabled + 0.38 alpha.

Remaining, intentional differences:

  • Selected fill treatment. Compose’s selected chip is a solid accentPrimary + contrast label; Swift’s selected chip is the soft accentPrimarySoft wash + cyan label. Both are token-driven static fills, a deliberate per-platform read of the selection wash.
  • Leading content. Compose exposes a leadingContent slot (e.g. a status dot); web has leadingIcon; the published Swift NockerlChip has no leading slot yet.