List
Vertical list container with single or multiple selection.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
value | string[] | [] | Selected values. Written as value="a;b" in markup, read as ['a', 'b'] from the property. |
disabled | boolean | false | Dims the whole list and ignores clicks and keyboard. |
multiple | boolean | false | Allow several rows to be selected; clicking a selected row deselects it. |
required | boolean | false | Keep at least one row selected: clicking the only selected row does nothing. |
swipeable | boolean | false | Lets rows wrapped in a c2-swipe-action swipe to reveal their actions, and run them by their shortcut keys. Off by
default: a wrapped row then stays still, and its actions are hidden and out of the Tab order. |
Slots
| Name | Description |
|---|---|
default | The rows: c2-list-item elements, or wrappers around one (a framework island, a c2-swipe-action for swipe actions), plus <hr> dividers and heading elements. |
Events
| Name | Type | Description |
|---|---|---|
selection-change | CustomEvent<SelectionChangeEventDetail> | Fired after the user changes the selection. detail.value is the array of selected values, detail.data the matching data of each row. Does not bubble: several components fire selection-change, so a listener belongs on the element itself rather than on an ancestor. |
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-list--background | color | #ffffff | |
--c2-list--gap | pixel | — | |
--c2-list--border-top-left-radius | border-radius | — | |
--c2-list--border-top-right-radius | border-radius | — | |
--c2-list--border-bottom-left-radius | border-radius | — | |
--c2-list--border-bottom-right-radius | border-radius | — | |
--c2-list--border-top | border | — | |
--c2-list--border-bottom | border | — | |
--c2-list--border-right | border | — | |
--c2-list--border-left | border | — | |
--c2-list--box-shadow | box-shadow | — | |
--c2-list--padding-top | padding | 4px | |
--c2-list--padding-bottom | padding | 4px | |
--c2-list--padding-right | padding | 4px | |
--c2-list--padding-left | padding | 4px | |
--c2-list--max-height | pixel | — | Scrolls when the rows are taller than this. |
--c2-list__divider--color | color | #e4e4e7 | |
--c2-list__divider--margin | margin | 4px 0 | |
--c2-list__heading--color | color | #71717a | |
--c2-list__heading--font-size | font-size | 11px | |
--c2-list__heading--font-weight | font-weight | 600 | |
--c2-list__heading--letter-spacing | letter-spacing | 0.06em | |
--c2-list__heading--text-transform | text-transform | uppercase | |
--c2-list__heading--padding-top | padding | 10px | |
--c2-list__heading--padding-right | padding | 10px | |
--c2-list__heading--padding-bottom | padding | 4px | |
--c2-list__heading--padding-left | padding | 10px | |