EnChipGroup
Preview
Props
| Name | Description | Default | Control |
|---|---|---|---|
| qaId | Id that can be set for automation selectors. string | "" | |
| chips | The chips to render — strings, or objects with label and value keys. An
object may also carry unknown[] | unknown | |
| labelKey | Sets a different key to use to retrieve the label from the chips passed to the component. string | "label" | |
| valueKey | Sets a different key to use to retrieve the value from the chips passed to the component. string | "value" | |
| context | Context applied to every chip in the group. string | "" | |
| chipStyle | Treatment applied to every chip in the group. string | "tonal" | |
| pill | Renders every chip fully rounded. boolean | false | |
| removable | Gives every chip a remove button. boolean | false | |
| clickable | Makes every chip's name a control that emits boolean | false | |
| disabled | Dims the group and stops it responding. boolean | false | |
| max | How many chips to show before collapsing the rest into a number | 0 | |
| addLabel | Renders a trailing chip that emits string | "" | |
| emptyText | Shown when there are no chips. Omit to render nothing. string | "" |
Slots
chip
No description
Variables
| Name | Type | Description |
|---|---|---|
chip | unknown | — |
index | unknown | — |
add
No description
empty
No description
Events
update:chips
No description
remove
No description
Methods
No methods defined.
Guidelines
Use EnChipGroup as soon as the chips come from an array — a set of classes assigned to a contribution group, the tags on a record, the locations a plan covers. It builds the row from data and owns the removal plumbing, so the only thing left to write is what removal means.
Reach for a bare EnChip only for one or two fixed chips that aren't a list.
The data shape
Takes strings or objects — the same shape EnInputRadioGroup accepts. labelKey and valueKey point at other keys, and a PascalCase fallback means serialized .NET data works unchanged.
Any chip object may also carry context, chipStyle, pill, removable, clickable, disabled, href, removeLabel or qaId to override the group's setting for that one chip.
Removal: bind it, or handle it
Pressing a chip's × does two things: emits update:chips with the list minus that entry, and emits remove with the chip's value. Both fire either way, so:
- Bind
v-model:chipsand the list manages itself. - Or listen to
removeand splice the array yourself. - Or do both — bind the model for the list, and hang a save or a toast off
remove.
The chips prop is never mutated.
Dos
- Set
emptyTexton any group that can legitimately be empty. A row that silently renders nothing reads as a broken page. - Use
addLabelfor the add affordance rather than a button beside the row — it belongs inside the row, wrapping with the chips. - Use
maxon a group whose length is unbounded, so a record with forty tags doesn't push the rest of the panel off the screen.
Don'ts
- Don't use a chip group as a form control for selecting values — that's EnInputCheckboxGroup or EnInputSelectPlus. A chip group displays what is already chosen.
- Don't set
removableon a group whose entries can't actually be removed.
Examples
A tag row from plain strings
Objects, with a per-chip override
The Executive chip sets removable: false, so it stays put while the rest can be dropped.
Overflow
max caps how many chips show at once and collapses the rest behind a +N more chip that reveals them when pressed.
Replacing the chip rendering
The chip slot is scoped with { chip, index } and replaces every chip — for when a row needs something the props don't reach, such as an icon per entry.
Related
- EnChip — the single chip, and the context/treatment axes.
- Chips styleguide — the raw classes.