Collapsible
<zn-collapsible> | ZnCollapsible
Toggles between showing and hiding content when clicked
<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.
<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
<zn-collapsible caption="Expanded Attribute" description="Adding the expanded attribute will open the collapsible" expanded> <zn-button>Button</zn-button> </zn-collapsible>
Flush Attribute
<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>