v0.0.2
Demos (demo panel, opens in a new tab)

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

Basic usage: view
BLADE

label is the text of the trigger link, and the content to hide goes in the slot.

blade
<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>
PropValues
labelTrigger text

Open initially

Open initially: view
BLADE

With open, the area starts open; use it for details the user should see at once but may hide.

blade
<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>
PropValues
opentrue | false

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
label— — Required; text of the trigger link
openbooleanfalseOpen initially

Slots: default content (the area that opens and closes)

Developer notes

Events, hooks and details
  • When the area opens, the arrow next to the link flips and the state is announced with aria-expanded.
Zubazar UI · ZubazarDesigned for people.