Skip to main content

Collapsible
New

Collapsible is a disclosure component used to reveal additional content. It should contain a heading, followed by any additional content that is revealed on click.

Examples

Open in new window
<duet-collapsible heading="Click to open details">
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Aperiam impedit, possimus minima repudiandae.
</duet-collapsible>

<script>
// Select the above component
var collapsible = document.querySelector("duet-collapsible")

// Listen for toggle events
collapsible.addEventListener("duetToggle", function(e) {
console.log("open", e.target.open)
})
</script>
Open in new window
<duet-collapsible heading="Click to open details">
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Aperiam impedit, possimus minima repudiandae.
</duet-collapsible>
<duet-divider margin="small"></duet-divider>
<duet-collapsible heading="Click to open">
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
</duet-collapsible>
<duet-divider margin="small"></duet-divider>
<duet-collapsible heading="Click to">
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
</duet-collapsible>
<duet-divider margin="small"></duet-divider>
<duet-collapsible heading="Click to open">
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
</duet-collapsible>
Open in new window
<duet-collapsible heading="Click to open details" open>
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
</duet-collapsible>

Properties #

Property Attribute Description Type Default
heading heading The content for the collapsible heading. string ""
margin margin Controls the margin of the component. "auto" | "none" "auto"
open open Is the component expanded or collapsed. boolean false
theme theme Theme of the definition list. "" | "default" | "turva" ""

Events #

Event Description Type
duetToggle Event emitted when opened/closed CustomEvent<{ component: "duet-collapsible"; originalEvent: MouseEvent | KeyboardEvent; }>

Dependencies #

Depends on #

Graph #

graph TD;
duet-collapsible --> duet-icon
style duet-collapsible fill:#f9f,stroke:#333,stroke-width:4px

Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.



Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.