# Collapsible primitive
Source: https://texuli.com/primitives-page/collapsible/
# Collapsible
One button that shows or hides one region.
Import
`import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent } from '@texuli/primitives/collapsible';`
Pattern
[Disclosure (WAI-ARIA APG)](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/)
Size budget
4.0 KiB gzip for @texuli/primitives/collapsible
Reference
`packages/primitives/docs/prim-collapsible.md`
## Live demo
Right to left
Loading the Collapsible demo…
## Anatomy
Collapsible anatomy: each box holds the parts inside it.
- `CollapsibleRoot``CollapsibleTrigger`
- `CollapsibleContent`
## Behavior checks
`tests/behavior/scenarios/collapsible.spec.ts` runs **5 rows** against the Collapsible scenario on Chromium, WebKit and the Pixel 7. Each row asserts what a user or assistive technology can observe, held to the WAI-ARIA Authoring Practices pattern.
All 5 rows
- the named button controls collapsed content
- pointer activation expands and collapses the content
- Space and Enter activate the disclosure button
- a disabled disclosure cannot be opened
- the disclosure has no axe violations
### Limits
- Every row passes on every project; a flaky row gets at most two retries.
- Size: at most 4.0 KiB gzip for `@texuli/primitives/collapsible` (`pnpm size`).
- Open-to-focus: p75 at most 150 ms (asserted with `TEXULI_PERF=1`).
Collapsible
One button that shows or hides one region.
- Import
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent } from '@texuli/primitives/collapsible';- Pattern
- Disclosure (WAI-ARIA APG)
- Size budget
- 4.0 KiB gzip for @texuli/primitives/collapsible
- Reference
packages/primitives/ docs/ prim-collapsible.md
Loading the Collapsible demo…
Anatomy
CollapsibleRootCollapsibleTriggerCollapsibleContent
Behavior checks
tests/behavior/scenarios/collapsible.spec.ts runs 5 rows against the Collapsible scenario on Chromium, WebKit and the Pixel 7. Each row asserts what a user or assistive technology can observe, held to the WAI-ARIA Authoring Practices pattern.
All 5 rows
- the named button controls collapsed content
- pointer activation expands and collapses the content
- Space and Enter activate the disclosure button
- a disabled disclosure cannot be opened
- the disclosure has no axe violations
Limits
- Every row passes on every project; a flaky row gets at most two retries.
- Size: at most 4.0 KiB gzip for
@texuli/primitives/collapsible(pnpm size). - Open-to-focus: p75 at most 150 ms (asserted with
TEXULI_PERF=1).