Chip Group
A single row of chips or badges that collapses whatever does not fit into a +N indicator, recomputed as the row or its items change size.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
max | number | undefined | undefined | Most items to show, whatever the space. Unset shows as many as fit. |
expanded | boolean | false | Shows every item, wrapping onto more rows. |
expandable | boolean | false | Makes the indicator a button that expands the group, and adds a button that collapses it. |
more-label | string | more | Word after the count in the indicator's accessible name: 3 more. |
collapse-label | string | Show less | Text of the button that collapses an expanded group. |
Slots
| Name | Description |
|---|---|
(default) | The items: c2-chip, c2-badge, or any element using GroupItemSizeController from @c2n/core. Other elements are measured by the group itself. |
Events
| Name | Type | Description |
|---|---|---|
overflow-change | CustomEvent | The number of collapsed items changed. detail has visibleCount and hiddenCount. |
expanded-change | Event | The user expanded or collapsed an expandable group. Read expanded on the target. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
row | The flex row holding the visible items and the indicator. |
overflow | The +N indicator, a <button> when expandable. |
collapse | The button that collapses an expanded group. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-chip-group--gap | pixel | 6px | Space between items, included in the fit calculation. |
--c2-chip-group--align-items | align-items | center | |
--c2-chip-group__overflow--height | pixel | 28px | |
--c2-chip-group__overflow--min-width | pixel | 28px | |
--c2-chip-group__overflow--padding-left | padding | 8px | |
--c2-chip-group__overflow--padding-right | padding | 8px | |
--c2-chip-group__overflow--border-radius | border-radius | 999px | |
--c2-chip-group__overflow--border | border | 1px solid #e4e4e7 | |
--c2-chip-group__overflow--background-color | color | #f4f4f5 | |
--c2-chip-group__overflow--color | color | #52525b | |
--c2-chip-group__overflow--font-family | font-family | inherit | |
--c2-chip-group__overflow--font-size | pixel | 12px | |
--c2-chip-group__overflow--font-weight | font-weight | 500 | |
--c2-chip-group__overflow__hover--border | border | 1px solid #a1a1aa | Hover border of an expandable indicator and of the collapse button. |
--c2-chip-group__overflow__hover--color | color | #18181b | |
--c2-chip-group__overflow__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-chip-group__overflow__focus--outline-offset | pixel | 2px | |