Chip
Compact value token with optional selection, removal, variants, sizes, and disabled state.
- Selector
- ui-chip
- Package
- @ngnova/ui/chip
Import
import { UiChipComponent } from '@ngnova/ui/chip';Usage & variants
Live examples use the public ui-chip API, paired with the exact snippet a product team would paste into an Angular app.
Active component filters
Compact value token with optional selection, removal, variants, sizes, and disabled state.
Production guidance
Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.
When to use
Use for applied filters, multi-select values, or compact entities users can toggle or remove.
Watch for
Long projected labels truncate within the available width while removal remains visible.
Product recipes
Apply Chip in distinct, copyable product scenarios—not just an isolated component state.
Selectable and removable filters
Selection and removal remain separate native buttons with distinct semantics.
1 2 3 4
<ui-chip selectable [(selected)]="selected">Angular</ui-chip>
<ui-chip removable removeAriaLabel="Remove TypeScript filter" (removed)="removeFilter()">
TypeScript
</ui-chip>Team member picker
Represent selected people as removable chips and return focus to the picker after removal.
1 2 3 4 5 6 7
<div class="flex flex-wrap gap-2" aria-label="Selected reviewers">
@for (reviewer of reviewers(); track reviewer.id) {
<ui-chip removable (removed)="removeReviewer(reviewer.id)">
{{ reviewer.name }}
</ui-chip>
}
</div>API Reference
Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.
Inputs
variant 'neutral' 'neutral' | 'primary' | 'success' | 'warning' | 'danger' Semantic color treatment for the value.
size 'md' 'sm' | 'md' Compact or standard chip height and typography.
selectable false boolean Renders a native toggle button with aria-pressed.
selected false boolean Controlled selected state for selectable chips.
removable false boolean Shows a separately focusable removal action.
disabled false boolean Disables both selection and removal controls.
removeAriaLabel 'Remove' string Localized accessible name for the removal action.
| Name | Type | Default | Description |
|---|---|---|---|
variant | 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'neutral' | Semantic color treatment for the value. |
size | 'sm' | 'md' | 'md' | Compact or standard chip height and typography. |
selectable | boolean | false | Renders a native toggle button with aria-pressed. |
selected | boolean | false | Controlled selected state for selectable chips. |
removable | boolean | false | Shows a separately focusable removal action. |
disabled | boolean | false | Disables both selection and removal controls. |
removeAriaLabel | string | 'Remove' | Localized accessible name for the removal action. |
Outputs
selectedChange boolean Requests a controlled selection-state update.
removed void Requests removal without mutating the parent-owned collection.
| Name | Type | Description |
|---|---|---|
selectedChange | boolean | Requests a controlled selection-state update. |
removed | void | Requests removal without mutating the parent-owned collection. |
Accessibility
- Selectable chips use a native button and aria-pressed; removable chips expose a separate named button.
- Use a specific localized removeAriaLabel that includes the value when several removable chips are present.
- Disabled state applies to every interactive control in the chip.
Keyboard behavior
- Tab reaches selection and removal controls independently.
- Enter and Space use native button behavior for toggle and removal.
Testing guidance
- Use UiChipHarness to locate by text, inspect and toggle selection, and activate removal.
- Test every variant and size, disabled behavior, long labels, localized removal names, and parent collection updates.