Collapsible

Alignment target:@astryxdesign/core v0.7.1 · Collapsible

Choose which email and push notifications you receive. Mentions and direct messages are always delivered — everything else can be turned off or batched into a daily digest. Quiet hours pause push notifications overnight in your local time zone without affecting email.

Usage #

Collapsible folds one content region behind a trigger: the trigger stays visible and a click expands or collapses the content underneath. It belongs in settings panels, FAQ pages, and detail views — places where the page should stay easy to scan while still letting people drill into what they care about. Several collapsibles side by side form a plain accordion, each managing its own state.

The shortest form gives a label and the content:

Vue
<script setup lang="ts">
import { Collapsible } from '@astryx-vue/core/Collapsible'
</script>

<template>
  <Collapsible trigger="Shipping address">
    <p>Orders leave the warehouse within one business day, and the tracking number is emailed as soon as the parcel is scanned.</p>
  </Collapsible>
</template>

A collapsible starts expanded. Pass :default-is-open="false" when the content should stay hidden until someone asks for it. In that mode the component owns the state: clicking the trigger flips the content and reports the new state through the openChange event.

When something outside the component decides, lift the state with v-model:is-open. The component then renders exactly what the bound value says, and a click is only a request to change it:

Vue
<script setup lang="ts">
import { Collapsible } from '@astryx-vue/core/Collapsible'
import { ref } from 'vue'

const isOpen = ref(false)
</script>

<template>
  <Collapsible v-model:is-open="isOpen" trigger="Release notes">
    <p>Version 4.2 adds inline comments to shared reports.</p>
  </Collapsible>
</template>

The trigger is normally a plain text label passed to the trigger prop. When the label needs a heading, an icon, or extra controls, use the trigger slot instead; it replaces the prop completely. Expanding and collapsing play a real transition: the content region's height, padding, and opacity change together, and under prefers-reduced-motion: reduce the change lands immediately without the movement.

The trigger and the content are linked with aria-expanded and aria-controls, so a screen reader can move from the button straight to the region it controls. While collapsed the region stays the same element — aria-controls always points at it — but it is set to display: none, which keeps it out of the tab order and out of the accessibility tree.

chevronPosition decides which side of the label carries the disclosure chevron. The default end follows the label and points down while collapsed, up while expanded. Set it to start to lead the label with an arrow that points into the content while collapsed — mirrored in right-to-left layouts — and turns down when expanded, matching the rows of a file tree.

isDisabled dims the trigger, stops it responding to clicks, marks it aria-disabled, and takes it out of the tab order. It never collapses content that is already open; it only stops further changes.

Anatomy

ElementDescription
ContainerThe root that contains one trigger and its controlled content and, in a divided group, paints the item divider.
TriggerThe always-visible button that toggles the content. Shows a label and a chevron indicator.
ChevronAnimated disclosure arrow. It follows the label by default; chevronPosition="start" moves it ahead of the label, points inward when collapsed (mirrored under RTL), and turns down when expanded.
ContentThe area that hides or reveals when the trigger is clicked.
Group containerThe CollapsibleGroup wrapper rendered when dividers are enabled. It contains the coordinated items and carries their density.

Best practices #

GuidancePractices
DoName what the section holds. The label is the button's accessible name, so a vague "More" or "Details" leaves screen reader users guessing.
DoCollapse content that is long or only occasionally needed. A single short paragraph is better shown directly than hidden behind a click.
DoLift the state with v-model:isOpen when something outside the component decides, so the parent stays the single source of truth.
DoUse chevronPosition="start" for nested rows and lists, where the arrow leaning into the content matches the file-tree convention, and keep the default end for standalone sections.
DoKeep the trigger to its label. Put actions inside the content region or on their own row so a click is never ambiguous.
Don'tHide critical or required content behind a collapsible. Many people will never open it, and the information is lost.
Don'tNest collapsibles more than two levels deep; the content becomes hard to find and navigate.
Don'tPut the outcome of an action or an error inside a collapsible. Show that kind of message directly, or use a banner.

Examples #

Collapsible — Controlled

Step 1 of 3
Name, email, and photo. Changes save as you type; the email address needs confirmation from the new inbox before it takes effect.
Open in Playground

Manage the open section from parent state, so something other than a click can move it: a URL parameter, a form jumping to the step that failed validation, or the Previous/Next controls shown here.

Collapsible — FAQ

Billing and plans
Upgrades take effect immediately and we charge the difference for the days remaining in the cycle. Downgrades take effect at the next renewal, so you keep the higher tier until the period you already paid for runs out. Seat changes work the same way: added seats are prorated to the day, removed seats free up at renewal.
Open in Playground

FAQ built with hasDividers: row hairlines and density padding with no custom CSS. Questions use body semibold so a list of questions reads as rows rather than a stack of headings.

Collapsible — Multiple mode

Real-time collaboration, full version history, and granular permissions. Every plan includes unlimited documents and unlimited guests — seats are counted for editors only.
Free for up to 5 editors. Pro is $12 per editor per month billed annually, or $15 month to month. Non-profit and education pricing is 50% off any paid plan.
Open in Playground

Several sections open at once, for comparing across them. One Collapsible per Card, so each trigger keeps its own large type: it is the heading of its surface, not a row in a list.

Collapsible — Single mode

Language, time zone, and date format. Time zone drives every timestamp in the product, including exports and scheduled reports.
Open in Playground

Only one section open at a time, so a single body of content competes for attention. Use defaultValue to pre-expand whichever section a first-time reader needs.

Collapsible — With dividers

Build 4,182 shipped to production from main. 847 modules compiled with no warnings, and the bundle came in at 142 KB gzipped — 3 KB under the budget. Deployed by Sarah Chen · April 18, 3:42 PM · 2m 14s
12 variables configured across production and preview. Secrets are encrypted at rest with AES-256 and are never printed in build logs. Last updated March 30 by the deploy bot
The previous build stays warm for 24 hours, so a rollback swaps traffic back in a few seconds without a rebuild. After that window a rollback redeploys from source and takes about two minutes. Previous build 4,181 · expires in 19h
Open in Playground

A flat list on the page background with hand-placed Dividers, for detail panels and sidebars where cards would add too much weight.