A shadcn-style collapsible component built with Ark UI primitives.

Installation

npx shadcn@latest add @ark-cn/collapsible

Usage

import * as Collapsible from "@/components/ui/collapsible"

Read exported parts in src/components/ui/collapsible.tsx and compose the primitive according to the Ark UI pattern for this component.

Examples

Partial Collapse

Ark UI gives you headless primitives, while your app controls layout, typography, spacing, and motion.

With partial collapse, users can preview a snippet without opening the whole section.

This works well for long descriptions, changelogs, or expandable detail blocks in dense interfaces.

Use collapsedHeight or collapsedWidth to build a "show more/less" pattern.
When set, the content collapses to that dimension instead of 0px.

Ark exposes CSS variables --collapsed-height and --collapsed-width so you can tune open/close animations without layout jerk.

Nested Collapsibles

Ark UI also supports additional collapsible patterns such as initial-open, lazy-mount, disabled, and root-provider composition.

API reference

This component mirrors the upstream Ark UI primitive.

See the ARK UI documentation for the full API.

Accessibility

See the Ark UI documentation for clarification.