Collapsible
Collapsible shows and hides one content region. Use it for a single expandable section. For a stacked set of sections, use Accordion.
This example also needs: Button.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
Open
Set defaultOpen to show the content on first render.
Disabled
Set disabled so the trigger cannot toggle the content.
Props
Collapsible
Collapsible adds no props of its own; it accepts the props of the element or primitive it wraps.
CollapsibleContent
CollapsibleContent adds no props of its own; it accepts the props of the element or primitive it wraps.
CollapsibleTrigger
CollapsibleTrigger adds no props of its own; it accepts the props of the element or primitive it wraps.
Collapsible shows and hides one content region. Use it for a single expandable section. For a stacked set of sections, use Accordion.
This example also needs: Button.
Installation
Install the following dependencies:
Copy and paste the following code into your project.
components/collapsible/Collapsible.vue components/collapsible/CollapsibleContent.vue components/collapsible/CollapsibleTrigger.vue components/collapsible/index.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
Open
Set default-open to show the content on first render.
Disabled
Set disabled so the trigger cannot toggle the content.
Props
Collapsible
Collapsible adds no props of its own; it accepts the props of the element or primitive it wraps.
CollapsibleContent
CollapsibleContent adds no props of its own; it accepts the props of the element or primitive it wraps.
CollapsibleTrigger
CollapsibleTrigger adds no props of its own; it accepts the props of the element or primitive it wraps.