If the choice should look like buttons, take CdsButtonToggle. For a choice out of a long list use CdsSelect, and for separate independent tags without selection just use CdsTag.
Variations
Selection
Give every tag a value — exactly this value lands in v-model. Without value the index of the tag in the group becomes its value. A repeated click on the selected tag clears the selection.
Multiple selection
The multiple prop allows selecting several tags — v-model becomes an array of values.
The max prop limits the number of selected tags: once the limit is reached, clicks on the remaining tags do not add to the selection.
Mandatory selection
The mandatory prop does not let you clear the last selection: a tag can only be switched. With the 'force' value the first available tag is selected automatically, even when v-model is empty.
Selection indicator
The filter prop adds a check icon to the selected tags — the selection reads not only from the fill. The filter-icon prop of the tag changes the icon, and the filter slot replaces it with your own markup.
Color and disabling
The group passes the color, active-color, disabled and filter props to its tags as defaults — there is no need to repeat them on every tag. color paints the unselected tags, active-color paints the selected one; without it the selected tag stays in the brand color so that the selection reads with any palette. disabled blocks the whole group: the selection is visible but cannot be switched. A prop set directly on a tag wins over the value of the group.
Layout
By default the tags stand in a single row, and the extra ones move into a horizontal scroll with arrows: the group is built on CdsSlideGroup and accepts its props — show-arrows, direction, center-active. The column prop wraps the tags into rows instead of scrolling — that way all the options are visible at once.
Guidelines
Scenarios
Catalog filter
A row of categories above the results is the most common job for a tag group. column shows all the categories at once, mandatory prevents ending up without a filter, and v-model gives you a ready key for the product request.
Picking several topics
When the values do not exclude each other, turn on multiple. max keeps the selection within reasonable bounds, filter marks the selected topics with a check, and the hint under the group explains the limit.
Switching the period
The group exposes the next, prev and select methods and the selected list — get them through a ref on the component. This is how tags get the back / forward arrows that walk through the periods in order.
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
activeColor | string | undefined | — | Color of the component in its active state |
centerActive | boolean | undefined | — | Forces the active component to be aligned to the center. |
color | string | undefined | — | Component color |
column | boolean | undefined | — | Lays the tags out in several rows with wrapping instead of a horizontal scroll. |
contentClass | any | — | Adds classes to the slide group container |
contentStyle | any | — | Adds inline styles to the slide group container |
direction | "horizontal" | "vertical" | undefined | 'horizontal' | Switches the component between horizontal and vertical layout. |
disabled | boolean | null | undefined | null | Disabled state |
filter | boolean | undefined | — | Shows a check icon on the selected tags (passed down to CdsTag). |
mandatory | boolean | "force" | undefined | — | Requires at least one item to stay selected |
max | number | undefined | — | Maximum number of items that can be selected |
mobile | boolean | null | undefined | null | Determines the display mode of the component: true renders it in mobile mode, false in desktop mode, null makes the mode depend on the current breakpoint. |
mobileBreakpoint | number | "xs" | "sm" | "md" | "lg" | "xl" | undefined | — | Sets the breakpoint at which the component switches to mobile mode. Accepts a number (for example, 600) or the name of a predefined breakpoint (xs, sm, md, lg, xl). |
modelValue | any | — | Value of the selected items of the group |
multiple | boolean | undefined | — | Allows selecting several items at once |
nextIcon | IconValue | undefined | 'chevron-right' | Icon for the “next” button. |
prevIcon | IconValue | undefined | 'chevron-left' | Icon for the “previous” button. |
required | boolean | "force" | undefined | — | Requires at least one item to stay selected |
scrollToActive | boolean | undefined | false | When true, the container scrolls the active component into view whenever it changes. |
selectedClass | string | undefined | 'cds-tag--selected' | CSS class applied in the selected state |
showArrows | string | boolean | undefined | — | Changes how the arrows are shown. By default the arrows appear on desktop devices when the container overflows and stay hidden on mobile devices. true also shows them on mobile on overflow, desktop always shows them on desktop, mobile always on mobile, always on both, and never disables the arrows. |
tag | string | JSXComponent<any> | undefined | 'div' | Custom HTML tag or component to render |
theme | string | undefined | — | Component theme |
Events
| Name | Type | Description |
|---|---|---|
update:modelValue | [value: unknown] | Fires when the selected value changes. |
Slots
| Name | Type | Description |
|---|---|---|
default | CdsTagGroupSlotProps | Tags of the group. The slot props expose the group state (selection, navigation). |
Exposed
| Name | Type | Description |
|---|---|---|
isSelected | (id: string) => boolean | Check whether a tag with the given id is selected |
next | () => void | Select the next tag |
prev | () => void | Select the previous tag |
select | (id: string, value: boolean) => void | Select a tag by id |
selected | readonly string[] | Ids of the selected tags |