Collapsible
Collapsible components allow users to toggle the visibility of content sections, providing a simple way to show or hide information on demand.
import {Collapsible} from "@qualcomm-ui/angular/collapsible"Examples
Showcase
Basic collapsible component with a trigger button that expands and collapses content.
Content
import {Component} from "@angular/core"
import {ButtonModule} from "@qualcomm-ui/angular/button"
import {CollapsibleModule} from "@qualcomm-ui/angular/collapsible"
@Component({
imports: [CollapsibleModule, ButtonModule],
selector: "collapsible-showcase-demo",
template: `
<div class="flex flex-col items-center" q-collapsible-root>
<button
class="my-3"
emphasis="primary"
q-button
q-collapsible-trigger
variant="fill"
>
Toggle
</button>
<div q-collapsible-content>
<div
class="border-neutral-01 box-border flex h-48 w-72 flex-col rounded-sm border p-4"
>
Content
</div>
</div>
</div>
`,
})
export class CollapsibleShowcaseDemo {}Controlled State
Control the collapsible's open/closed state using the open and openChanged properties.
Content
import {Component, signal} from "@angular/core"
import {ButtonModule} from "@qualcomm-ui/angular/button"
import {CollapsibleModule} from "@qualcomm-ui/angular/collapsible"
@Component({
imports: [CollapsibleModule, ButtonModule],
selector: "collapsible-controlled-demo",
template: `
<div
class="flex flex-col items-center"
q-collapsible-root
[open]="open()"
(openChanged)="open.set($event)"
>
<button
class="my-3"
emphasis="primary"
q-button
q-collapsible-trigger
variant="fill"
>
Toggle
</button>
<div q-collapsible-content>
<div
class="border-neutral-01 box-border flex h-48 w-72 flex-col rounded-sm border p-4"
>
Content
</div>
</div>
</div>
`,
})
export class CollapsibleControlledDemo {
readonly open = signal(true)
}Explorer
API
q-collapsible-root
Type
booleanDescription
The initial open state of the collapsible when rendered.
Use when you don't need to control the open state of the collapsible.
Type
'ltr' | 'rtl'
Description
The document's text/writing direction.
Type
booleanDescription
Whether the collapsible is disabled.
Type
() =>
| ShadowRoot
| Document
| Node
Description
A root node to correctly resolve the Document in custom environments. i.e.,
Iframes, Electron.
Type
booleanDescription
Whether to defer creating content until the first expansion.
Apply
shouldRender() from the content directive to its template.Type
booleanDescription
The controlled open state of the collapsible
Type
booleanDescription
Whether to destroy content after the collapse animation finishes.
Apply
shouldRender() from the content directive to its template.Type
voidDescription
Function called when the animation ends in the closed state
Type
booleanDescription
Function called when open changes.
data-collapsible-partValue
'root'data-stateValue
| 'open'
| 'closed'
| 'closing'
q-collapsible-trigger
data-collapsible-partValue
'trigger'data-disabledValue
'' | undefined
data-stateValue
| 'open'
| 'closed'
| 'closing'
q-collapsible-content
classValue
'qui-collapsible__content'data-collapsibleValue
'' | undefined
data-collapsible-partValue
'content'data-disabledValue
'' | undefined
data-ssrValue
'' | undefined
data-stateValue
| 'open'
| 'closed'
| 'closing'
| undefined
hiddenValue
booleanstyleValue
Updated by Olaf Kappes