Collapse
Opens and closes the area below a link when it is clicked; used to hide details at first sight.
zb:collapse zubazar/ui · free (MIT)
Basic usage
BLADE
label is the text of the trigger link, and the content to hide goes in the slot.
<zb:collapse label="Import details">
<p class="text-sm text-dim">1,248 rows were read: 1,201 products were added, 39 products were updated, and 8 rows were skipped because of an invalid barcode.</p>
</zb:collapse>
| Prop | Values |
|---|---|
label | Trigger text |
Open initially
BLADE
With open, the area starts open; use it for details the user should see at once but may hide.
<zb:collapse label="Skipped rows (3)" open>
<ul class="space-y-1 text-sm text-dim">
<li>Row 14 · Barcode has 12 digits</li>
<li>Row 87 · Category code not found</li>
<li>Row 203 · The same SKU is listed twice</li>
</ul>
</zb:collapse>
| Prop | Values |
|---|---|
open | true | false |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
label | — | — | Required; text of the trigger link |
open | boolean | false | Open initially |
Slots: default content (the area that opens and closes)
Developer notes
- When the area opens, the arrow next to the link flips and the state is announced with
aria-expanded.