Chip Group provides consistent spacing, accessible keyboard navigation, and selection modes to multiple Chips.
Overview
Chip Group supports workflows and patterns using more than one Chip. Chips are predictably spaced within the Chip Group, and opt-in selection modes can facilitate workflows with interactive Chips.
Usage
- Selection workflows
- Filtering patterns
- Toggling of categorical data
Sample
<calcite-chip-group label="demo-group-label">
<calcite-chip value="biome-a" label="Biome A">Biome A</calcite-chip>
<calcite-chip value="biome-b" label="Biome B">Biome B</calcite-chip>
<calcite-chip value="biome-d" label="Biome C">Biome C</calcite-chip>
<calcite-chip value="biome-d" label="Biome D">Biome D</calcite-chip>
<calcite-chip value="biome-e" label="Biome E">Biome E</calcite-chip>
</calcite-chip-group>
Accessibility
Keyboard navigation
Key | Function |
---|---|
Tab | Moves focus to the next calcite-chip . When calcite-chip is closable , moves focus in and out of the "Close" button. If the current focus is the last calcite-chip , focus will leave the component. |
Tab and Shift | Moves focus to the previous calcite-chip . When calcite-chip is closeable , moves focus in and out of the "Close" button. If the current focus is the first calcite-chip , focus will leave the component. |
Arrow left | Moves focus to the previous calcite-chip . If the current focus is the first calcite-chip , focus will return to the last calcite-chip . |
Arrow right | Moves focus to the next calcite-chip . If the current focus is the last calcite-chip , focus will return to the first calcite-chip . |
Space | When selection is not "none" , selects the focused calcite-chip . When calcite-chip is closeable and focused, hides the component. |
Enter | When selection is not "none" , selects the focused calcite-chip . When calcite-chip is closeable and focused, hides the component. |
Home | Moves focus to the component's first calcite-chip . |
End | Moves focus to the component's last calcite-chip . |
API reference
Properties
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
disabled | disabled | When true , interaction is prevented and the component is displayed with lower opacity. | boolean | false |
label | label | Accessible name for the component. | string | |
scale | scale | Specifies the size of the component. Child calcite-chip s inherit the component's value. | "l" | "m" | "s" | "m" |
selectedItems | Specifies the component's selected items. | Array<HTMLCalciteChipElement> | ||
selectionMode | selection-mode | Specifies the selection mode of the component, where:
"multiple" allows any number of selections,
"single" allows only one selection,
"single-persist" allows one selection and prevents de-selection, and
"none" does not allow any selections. | "multiple" | "none" | "single" | "single-persist" | "none" |
Slots
Name | Description |
---|---|
default (unnamed) | A slot for adding one or more calcite-chip s. |
Events
Name | Description | Behavior |
---|---|---|
calciteChipGroupSelect | Fires when the component's selection changes. |
Methods
Name | Description | Signature |
---|---|---|
componentOnReady | Create a promise that resolves once component is fully loaded. | componentOnReady(): Promise<void> |
setFocus | Sets focus on the component's first focusable element. | setFocus(): Promise<void> |