Web Component Usage
Bolt Accordion is a fully client-side renderable web component. Add the bolt-accordion
element containing any number of bolt-accordion-item
elements to create an accordion. Inside each bolt-accordion-item
mark the "trigger" content with the attribute slot="trigger"
. Everything else is considered accordion "content".
Accordion item 1
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Accordion item 2
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Accordion item 3
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
<bolt-accordion>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 1</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 2</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 3</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
</bolt-accordion>
Prop Usage
Configure the accordion with the properties specified in the schema. One property that is unique to the Web component is no-separator
. Use this prop rather than the separator
prop used in Twig.
Accordion item 1 with a lot of text in the trigger, which could wrap to multiple lines, and this trigger and the icon are vertically aligned center
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Accordion item 2
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Accordion item 3
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
<bolt-accordion spacing="small" icon-valign="top" box-shadow no-separator multiple>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 1 with a lot of text in the trigger, which could wrap to multiple lines, and this trigger and the icon are vertically aligned center</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 2</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 3</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
</bolt-accordion>
Advanced Usage
Two advanced options are shown below. Automatically show an bolt-accordion-item
by adding the open
prop.
Accordion item 1
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Accordion item 2
This item is opened by default. Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Accordion item 3
Lorem ipsum dolor sit, amet consectetur adipisicing elit.
<bolt-accordion>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 1</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
<bolt-accordion-item open>
<bolt-text slot="trigger">Accordion item 2</bolt-text>
<bolt-text>This item is opened by default. Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
<bolt-accordion-item>
<bolt-text slot="trigger">Accordion item 3</bolt-text>
<bolt-text>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</bolt-text>
</bolt-accordion-item>
</bolt-accordion>