Details
Collapsible disclosure built on native details and summary.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
expanded | boolean | false | Open state, kept in sync with the native `open` attribute. |
label | string | — | Header text when the `title` slot is empty. |
name | string | undefined | undefined | Accordion group: opening a panel closes every other `c2-details` with the same name in the same document or shadow
root. (The native `name` attribute cannot be used: each panel's ` ` sits in its own shadow tree.) |
title-not-clickable | boolean | false | Only the icon toggles the panel; clicking the title does nothing. |
disabled | boolean | false | Dims the header and blocks toggling (pointer and keyboard). |
Events
| Name | Type | Description |
|---|---|---|
toggle | ToggleEvent | Re-dispatched from the native details after it opens or closes (`newState` is `open` or `closed`). |
CSS custom properties
Grouped by the element and state they target. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-details--border-top | border | 1px solid rgb(213, 213, 213) | |
--c2-details--border-right | border | 1px solid rgb(213, 213, 213) | |
--c2-details--border-bottom | border | 1px solid rgb(213, 213, 213) | |
--c2-details--border-left | border | 1px solid rgb(213, 213, 213) | |
--c2-details--border-top-left-radius | border-radius | 8px | |
--c2-details--border-top-right-radius | border-radius | 8px | |
--c2-details--border-bottom-left-radius | border-radius | 8px | |
--c2-details--border-bottom-right-radius | border-radius | 8px | |
--c2-details--background | background | rgb(255, 255, 255) | |
--c2-details--box-shadow | box-shadow | — | |
--c2-details--transition-duration | time | 250ms | Open and close animation length; `0ms` disables it. Respects `prefers-reduced-motion`. |
--c2-details__header--padding-top | padding | 12px | |
--c2-details__header--padding-right | padding | 16px | |
--c2-details__header--padding-bottom | padding | 12px | |
--c2-details__header--padding-left | padding | 16px | |
--c2-details__header--background | background | — | |
--c2-details__header--color | color | — | |
--c2-details__header--font-weight | font-weight | 500 | |
--c2-details__header--font-size | font-size | — | |
--c2-details__header--gap | pixel | 12px | |
--c2-details__header--flex-direction | flex-direction-row | row | `row-reverse` puts the icon first. |
--c2-details__header__icon--width | pixel | 20px | |
--c2-details__header__icon--height | pixel | 20px | |
--c2-details__header__icon--rotate | pixel | 180deg | |
--c2-details__header__icon--color | color | rgb(109, 109, 109) | |
--c2-details__header__content--margin-top | pixel | 4px | |
--c2-details__header__content--color | color | rgb(109, 109, 109) | |
--c2-details__header__content--font-size | font-size | 13px | |
--c2-details__header__content--font-weight | font-weight | 400 | |
--c2-details__header__hover--background | background | rgb(248, 248, 248) | |
--c2-details__header__hover--color | color | — | |
--c2-details__header__open--background | background | — | |
--c2-details__header__open--color | color | — | |
--c2-details__header__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-details__header__focus--outline-offset | pixel | -2px | |
--c2-details__header__disabled--opacity | opacity | 0.38 | |
--c2-details__content--padding-top | padding | 4px | |
--c2-details__content--padding-right | padding | — | Falls back to the header padding. |
--c2-details__content--padding-bottom | padding | — | Falls back to the header padding. |
--c2-details__content--padding-left | padding | — | Falls back to the header padding. |
--c2-details__content--color | color | — | |
--c2-details__content--border-top | border | — | Divider between header and content. |