Collapsible <pm-collapsible>
Collapsible: content that opens and closes under a heading, or a long text cut short with "Show more".
Orders ship within two working days from our warehouse in Rotterdam. You get a tracking link by email as soon as the parcel leaves. Delivery inside the EU takes two to four days, and five to nine days elsewhere. Returns are free for 30 days: print the label from your account and hand the parcel to any pickup point. Refunds reach your card within five working days after we receive the parcel.
States
Each state is one attribute.
DisabledOverview
With heading (or the trigger slot) it is one disclosure: a button that shows and hides the content. With preview-size the start of the content stays visible, fades out at that height, and a "Show more" button under it opens the rest; when the content is shorter than that, there is no button. For a group where one section closes the others, use <pm-accordion>.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Open. Setting it opens or closes it (without pm-toggle). |
heading | string | — | Text of the button. |
disabled | boolean | false | The button does nothing. |
preview-sizeprop: previewSize | string | — | Height of the part that stays visible while closed, e.g. 6rem. Turns on the "Show more" layout. |
more-labelprop: moreLabel | string | — | Button text while closed, with preview-size (default "Show more"). |
less-labelprop: lessLabel | string | — | Button text while open, with preview-size (default "Show less"). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-toggle | onPmToggle | Before it opens or closes (cancelable). detail.open is the new state. |
pm-open | onPmOpen | Opened. |
pm-close | onPmClose | Closed. |
Slots
| Slot | Description |
|---|---|
(default) | The content. |
trigger | What the button shows, instead of heading. |
CSS parts
| Part | Description |
|---|---|
::part(trigger) | The button. |
::part(content) | The part that opens. |
Methods
show(), hide(), toggle()