Skip to content

Navigation

ICollapsible

One region that opens and closes — the bare disclosure behind IAccordion.

One region, no siblings

Use ICollapsible when there is exactly one thing to hide: an "advanced options" block in a form, a stack trace under an error, a long description behind a "read more". IAccordion is the one that coordinates a list of panels.

Give the content a little inset

The content is clipped on every side while it animates, so anything painting outside its own box — a focus ring, a switch's rounded track — loses a sliver. Pad the content by p-1 or more on any side that would otherwise sit flush.

vue
<ICollapsible label="Advanced options">
  <div class="px-1 pt-3 pb-1">…</div>
</ICollapsible>

The trigger

label sets the trigger text. For a count, a badge or a two-line summary, use the trigger slot, which receives the open state.

vue
<ICollapsible v-model:open="open">
  <template #trigger="{ open }">
    <span>Attachments</span>
    <IBadge size="sm">3</IBadge>
  </template>

  <FileList />
</ICollapsible>

icon-position moves the chevron to the leading edge, and hide-icon drops it for a trigger that signals its state some other way.

Unmounting

The content stays in the DOM while closed. unmount-on-hide removes it instead, which drops the height animation — use it when the content is expensive to render, or should stay out of the browser's in-page search while shut.

vue
<ICollapsible label="Raw response" unmount-on-hide>
  <ExpensiveViewer />
</ICollapsible>

Props

PropTypeDefaultDescription
openbooleanTwo-way via v-model:open
defaultOpenbooleanfalseStarting state when uncontrolled
labelstringTrigger text; ignored with the trigger slot
iconPosition'start' | 'end''end'Which side the chevron sits on
hideIconbooleanfalseDrop the chevron
unmountOnHidebooleanfalseRemove the content while closed
disabledbooleanfalse
unstyledbooleanSkip built-in classes
ui{ root?, trigger?, content?, icon? }Per-slot class overrides

Events

EventPayload
update:openboolean

Slots

SlotPropsDescription
trigger{ open }Replaces the trigger's contents
default{ open }The content that opens and closes

Accessibility

The trigger is a <button> carrying aria-expanded and pointing at the content with aria-controls, so a screen reader announces what it does and what state it is in.