Skip to content

Accordion - Web Component

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

Parameters

The Web component uses the <z-accordion> tag:

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescription
configstring

Sets the size of the accordion item. Default is m. You can also set it as l.

summarystringThe title of the accordion item
openbooleanIf the accordion item is open or closed
contentstringThe content of the accordion item

The available slots for the component are:

NameTagsDescription
defaultspan
summaryspan

config

The config attribute it's used to set the size of the accordion item. Default is m. You can also set it as l.

Body text inside accordion

summary

The summary attribute is used to set the text label of the accordion item. Make sure you always use it.

open

The open attribute is used to set the accordion item as open by default. Default is false.

Playground

Customization

HTML Examples

Imports
html
<link rel="stylesheet" href="/0.5.1/@zurich/web-components/styles.css" />
<script type="module" src="/0.5.1/@zurich/web-components/accordion.js"></script>
Code
html
<z-accordion summary="Accordion item" size="l">
  Body text lorem ipsum dolor sit amet, consectetur adipiscing elit,
  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</z-accordion>