j3w1 / theme

j3w1 / theme4.0.0

j3w1 / command

  • SPEC Overview
  • SPEC Foundations
  • SPEC Components
  • SPEC Patterns
  • SPEC Tokens
  • SPEC Tools
  • SPEC Workbench
  • SPEC Form builder
  • SPEC Task kit
  • SPEC Recipes
  • SPEC Figma bridge
  • SPEC Report an issue
  • SPEC Implement
  • SPEC For agents
  • SPEC Ports
  • SPEC Releases
  • SPEC Specification
  • DEMO Vue application demo

Chip

A square bordered token for a filter, a removable value or a static tag; a pressed filter chip takes the selection fill and a check glyph.

stable · light DOM · 4.0.0. Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.

Live variants

filter

Markup
<j3w1-chip id="example-chip-filter"><button class="chip chip-filter" type="button" aria-pressed="false"><span class="chip-check" aria-hidden="true">✓</span><span class="chip-label">Navigation</span></button></j3w1-chip>

removable

tabs
Markup
<j3w1-chip id="example-chip-removable"><span class="chip chip-removable"><span class="chip-label">tabs</span><button class="chip-remove" type="button" aria-label="Remove tabs"><span aria-hidden="true">×</span></button></span></j3w1-chip>

static

R1
Markup
<j3w1-chip id="example-chip-static"><span class="chip chip-static"><span class="chip-label">R1</span></span></j3w1-chip>

Install and register

Use the exact version. If npm publication is pending, install the release tarball from the installation guide.

npm install --save-exact @j3w1/ui@4.0.0
import '@j3w1/ui/tokens.css';
import '@j3w1/ui/styles/chip.css';
import '@j3w1/ui/register/chip';

Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.

Vue SFC, React, Astro and plain HTML integration →

Copy the complete implementation

npx --package=@j3w1/ui@4.0.0 j3w1-ui copy chip --out ./vendor/j3w1/chip

The CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.

Public API

attributes

NameType / signatureMeaning
disabledCustomEventDisable the native controls owned by this instance.
loadingCustomEventMark the primary control busy and prevent duplicate activation.

properties

NameType / signatureMeaning
disabledbooleanDelegates disabled state to native children.
namestringNative control name; application form keys remain explicit.

methods

NameType / signatureMeaning
refresh(): voidReconnect behavior after replacing native child structure.
focus(options?: FocusOptions): voidFocus the first usable native control.
dismiss(id?: string): voidDismiss a message; focused actions move to the next available control.

events

NameType / signatureMeaning
j3w1-dismissCustomEventCancelable message dismissal.
j3w1-retryCustomEventRequest recovery; the host owns the result.
j3w1-actionCustomEventAn explicit message action.

Dependencies and verification

Registered components: none. Style dependencies: none.

Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.

Full implementation manifest, API and token dependency closure

Canonical specification

Chip chip

  • Family: Information display
  • Maturity: stable
  • Priority: R1
  • Since: 0.1.0
  • Native control: native button with aria-pressed for filters; a span with a labelled remove button for values; a plain span for tags
  • specified
  • demonstrated

A square bordered token for a filter, a removable value or a static tag; a pressed filter chip takes the selection fill and a check glyph.

Report an issue with this component

Tokens

Focus a role to inspect its values; follow its link for persistent usage and source details.

PartRoleValueUse
root.bgcolor.surface.defaultapproveduse#0d0707D-041 surface.default: color.primitive.modern.panel.
root.bordercolor.border.controlapproveduse#c81a1aD-041 owner correction: red control and floating-frame borders, distinct from rose text.
root.textcolor.text.defaultapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
root.bg-hovercolor.interaction.hover.bgapproveduse#1c1010D-041 interaction.hover.bg: color.primitive.modern.hover.
root.bg-pressedcolor.interaction.pressed.bgobserveduse#420f0cPressed fill.
root.ringcolor.interaction.focus.ringobserveduse#e539351px dashed focus ring on controls and rows.
root.text-disabledcolor.text.disabledapproveduse#a3676bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
root.border-disabledcolor.border.disabledapproveduse#482b2bD-041 border.disabled: color.primitive.modern.divider.
root.bg-disabledcolor.interaction.disabled.bgapproveduse#0d0707D-041 interaction.disabled.bg: color.primitive.modern.panel.
selected.bgcolor.interaction.selection.bgapproveduse#531310Selected row, tab, workspace; D-027 recessed the fill, leaving the 2px indicator and the check to carry selection.
selected.textcolor.interaction.selection.textobserveduse#f4eeeeText on the selection.
selected.ringcolor.interaction.focus.ringobserveduse#e539351px dashed focus ring on controls and rows.
remove.textcolor.text.mutedapproveduse#d4868bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
remove.text-hovercolor.text.brightapproveduse#ffa2a7D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
remove.bg-hovercolor.interaction.hover.bg-strongapproveduse#1c1010D-041 interaction.hover.bg-strong: color.primitive.modern.hover.

State matrix

Every declared state and combination, statically rendered; the default cell is live. Sizes: compact, comfortable (switch with the density control above).

StateFilterRemovableStatic
default
tabs
R1
hover
focus-visible
selected
selected+focus-visible
disabled

Purpose

One value the user can toggle or remove: a filter, a multiselect choice, a record’s tag. A chip that only informs is a badge; one that runs an action is a button.

Anatomy

Parts as listed in the anatomy; a static chip is a span with nothing else.

States

StateVisualNon-colour channel
default1px color.border.control on color.surface.default; text color.text.default—
hoverbackground → color.interaction.hover.bg; remove button → color.interaction.hover.bg-strong with color.text.brightcursor: pointer
focus-visible1px dashed color.interaction.focus.ring at −2px on the chip or the remove buttonthe ring
selectedfill color.interaction.selection.bg; text and glyph color.interaction.selection.text; border takes the fill colouraria-pressed="true"; the ✓ glyph
selected+focus-visiblethe fill and 1px dashed color.interaction.focus.ring at −2pxboth visible at once
disabledcolor.text.disabled, color.border.disabled, color.interaction.disabled.bg; no hoverdisabled; cursor: not-allowed

A filter chip shows color.interaction.pressed.bg only while pressed. Precedence: disabled > selected > hover; focus-visible is always drawn.

Keyboard

As in the key table. The label of a removable chip is not focusable; inside a token field the field owns Backspace and the arrow keys.

Accessibility

A filter chip keeps the same label in both states; the ✓ is aria-hidden. The remove button’s name (“Remove ”) is unambiguous out of context; removing a chip moves focus to the next chip or the field. Text meets 4.5:1; border and rings 3:1. Chips and remove buttons are at least 24×24 CSS pixels in compact, with 4px between neighbours.

Portability

A bordered box with a background and an outline; the remove control is an ordinary small button. Native toggle buttons take the fill for the checked state. A host without a glyph draws the check as a 2px inset rule at the inline start and records it.

Non-examples

Pill or rounded chips. A selected chip shown by border colour alone, without the fill and aria-pressed. A nameless ×. A chip that is a link. A static tag that reacts to hover. Disabling by opacity. A label clipped by the border. A chip in caption type (that is a badge).

Contrast report

13 declared pairs measured on resolved sRGB values with the WCAG 2.x formula; 0 waived (decorative only), 0 failing. A pass is a design target for the named role, not an application-wide conformance claim.

PairStateKindForegroundBackgroundRatioMinResult
chip default textdefaulttextcolor.text.default #e99499color.surface.default #0d07078.724.5pass
chip default borderdefaultuicolor.border.control #c81a1acolor.surface.default #0d07073.443pass
chip hover texthovertextcolor.text.default #e99499color.interaction.hover.bg #1c10108.104.5pass
chip hover borderhoveruicolor.border.control #c81a1acolor.interaction.hover.bg #1c10103.203pass
chip focus-visible textfocus-visibletextcolor.text.default #e99499color.surface.default #0d07078.724.5pass
chip focus-visible borderfocus-visibleuicolor.border.control #c81a1acolor.surface.default #0d07073.443pass
chip focus-visible outlinefocus-visibleuicolor.interaction.focus.ring #e53935color.surface.default #0d07074.733pass
chip selected textselectedtextcolor.interaction.selection.text #f4eeeecolor.interaction.selection.bg #53131012.474.5pass
chip selected+focus-visible textselected+focus-visibletextcolor.interaction.selection.text #f4eeeecolor.interaction.selection.bg #53131012.474.5pass
chip selected+focus-visible outlineselected+focus-visibleuicolor.interaction.focus.ring #e53935color.interaction.selection.bg #5313103.383pass
remove glyph at rest—textcolor.text.muted #d4868bcolor.surface.default #0d07077.224.5pass
disabled chip text (exempt; house floor 3:1)disableduicolor.text.disabled #a3676bcolor.interaction.disabled.bg #0d07074.483pass
disabled chip border (exempt)disableduicolor.border.disabled #482b2bcolor.interaction.disabled.bg #0d07071.581pass

Keys

KeyAction
Tab / Shift+TabReaches a filter chip, or the remove button of a removable chip; static chips are skipped.
Space / EnterToggles a filter chip; activates the remove button.
Backspace / DeleteIn a token field, removes the chip before the caret (the field's contract, not the chip's).

For agents

Component JSON ·Implementation brief ·Build a task kit ·

Related: badge button multiselect combobox toolbar

Stress fixtures: FX-LONG FX-320 FX-ZOOM-200 FX-I18N FX-RTL FX-RM FX-HC FX-TOUCH FX-STATE-MATRIX