Chip
Directive for compact selected values, filter tokens, tags, and entity references.
Import the public directives from the published package entrypoint.
import { KuiChipDirective, KuiChipRemoveDirective } from '@kikita-labs/ui';kuiChip applies to a span for a static, non-interactive chip, or to a button/a for an interactive chip. Chip represents a chosen value or removable filter; Badge represents status. See the Badge docs when you need a status marker instead.
<div class="basic-chip-example">
<span kuiChip>Design</span>
<span kuiChip appearance="primary">Engineering</span>
<span kuiChip appearance="success">Shipped</span>
</div>Nest a button[kuiChipRemove] inside the chip and listen for (removed) to drop a value from a collection.
<div class="removable-chip-example">
@for (tag of tags(); track tag) {
<span kuiChip appearance="primary" (removed)="removeTag(tag)">
<span class="kui-chip-label">{{ tag }}</span>
<button kuiChipRemove type="button" [attr.aria-label]="'Remove ' + tag"></button>
</span>
}
</div>Use a native button host when the chip itself toggles a filter or selection instead of only removing a value.
<div class="interactive-chip-example">
<button
kuiChip
type="button"
[appearance]="selected() === 'all' ? 'primary' : 'neutral'"
(click)="select('all')"
>
All
</button>
<button
kuiChip
type="button"
[appearance]="selected() === 'open' ? 'primary' : 'neutral'"
(click)="select('open')"
>
Open
</button>
<button
kuiChip
type="button"
[appearance]="selected() === 'closed' ? 'primary' : 'neutral'"
(click)="select('closed')"
>
Closed
</button>
</div>disabled reduces opacity and makes the nested remove action inert. invalid shows the invalid border treatment.
<div class="chip-states-example">
<span kuiChip disabled>
<span class="kui-chip-label">Design</span>
<button kuiChipRemove type="button" aria-label="Remove Design"></button>
</span>
<span kuiChip invalid appearance="danger">Missing owner</span>
</div>Inputs and outputs verified against @kikita-labs/ui v1.6.1 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| appearance | 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral' | Semantic visual treatment mapped to Kikita UI status tokens. |
| size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Chip size. sm is the size used inside Select and Combobox controls. |
| disabled | boolean | false | Reduces opacity and makes the nested remove action inert. |
| invalid | boolean | false | Shows the invalid border treatment. |
| removed | output: void | - | Emitted when a nested button[kuiChipRemove] is clicked. |
| kuiChipRemove | directive on button | - | Marks a native button as the chip remove action. Needs its own aria-label, for example "Remove Design". |
| --kui-chip-bg | CSS color | - | Chip background color. |
| --kui-chip-bg-hover | CSS color | - | Chip background color on hover for interactive chips. |
| --kui-chip-border | CSS color | - | Chip border color. |
| --kui-chip-text | CSS color | - | Chip label text color. |
| --kui-chip-radius | CSS length | - | Chip corner radius. |
| --kui-chip-height-xs | CSS length | - | Chip block size for size="xs". |
| --kui-chip-height-sm | CSS length | - | Chip block size for size="sm". |
| --kui-chip-height-md | CSS length | - | Chip block size for size="md" (default). |
| --kui-chip-height-lg | CSS length | - | Chip block size for size="lg". |
| --kui-chip-remove-color | CSS color | - | Remove icon color. |
| --kui-chip-remove-color-hover | CSS color | - | Remove icon color on hover. |
| --kui-chip-disabled-opacity | CSS number | - | Opacity applied to the whole chip when disabled. |
Chip keeps native element semantics instead of adding ARIA roles.
- Use a non-interactive host such as
spanfor a static chip. - Use a native
buttonorafor an interactive chip. - The remove action must be a native
button[kuiChipRemove]with its own accessible name, for examplearia-label="Remove Design". - Disabled chips mark the remove button
aria-disabled="true"andtabindex="-1". - Select and Combobox own keyboard behavior for Delete/Backspace selected-value removal; do not duplicate that handling when Chip is used inside those controls.