Skip to main content
Light Dark System

Collapsible

<zn-collapsible> | ZnCollapsible
Since 1.0 experimental

Toggles between showing and hiding content when clicked

Boo
<zn-collapsible caption="This is the caption"
                label="Optional label"
                description="This is the description to accompany the caption"
                label="The Label">
  <span>Boo</span>
  <zn-icon src="android"></zn-icon>
</zn-collapsible>

Examples

Default Open

Used instead of directly setting the expanded attribute on the element.

Boo
<zn-collapsible caption="Default Open"
                label="Toggle"
                description="Setting the default state show the element in it's open state on load"
                default="open">
  <span>Boo</span>
  <zn-icon src="android"></zn-icon>
</zn-collapsible>

Expanded Attribute

Button
<zn-collapsible caption="Expanded Attribute" 
                description="Adding the expanded attribute will open the collapsible"
                expanded>
  <zn-button>Button</zn-button>
</zn-collapsible>

Flush Attribute

Button
<zn-collapsible caption="Flush" 
                description="The flush attribute removes the left margin of the content"
                flush>
  <zn-button>Button</zn-button>
</zn-collapsible>

Importing

If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.

To import this component from the CDN using a script tag:

<script type="module" src="https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.0/dist/components/collapsible/collapsible.js"></script>

To import this component from the CDN using a JavaScript import:

import 'https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.0/dist/components/collapsible/collapsible.js';

To import this component using a bundler:

import '@kubex/zinc/dist/components/collapsible/collapsible.js';

Slots

Name Description
header Clicking will toggle the show state of the data

Learn more about using slots.

Dependencies

This component automatically imports the following dependencies.

  • <zn-example>
  • <zn-icon>