Skip to main content
ContainersLevel 2

Collapsible

单项折叠

WebMobileDesktopDifficulty: Easy

Only one section stays open at a time — open a new one and the previous one closes itself.

01

Live Demo

Actually clickable

Scans the photo library for images and videos, spotting duplicates and similar shots.

Shows how much space each kind of file takes, and where the big cleanups are.

Deleted items are kept for 30 days and can be restored any time.

Try clicking the second one — the first collapses by itself. Only one item is ever open: that's a Collapsible.

What you just saw:You open the second panel in a list and the first one folds shut automatically — that is the default behavior of many accordions.

02

What it actually is

A collapsible and an accordion are two strategies for the same mechanism. An accordion lets several panels open at once; a collapsible is the mutually exclusive version. Which one to use comes down to the job: use an accordion when people need to compare, and a collapsible when they only need to read one thing at a time.

collapsiblesingle-open accordionexpandable sectionexclusive accordiondisclosure panel
03

Anatomy · What it's made of

  1. Trigger触发器

    The heading row plus a chevron

  2. Panel内容面板

    Only one is visible at any moment

  3. Indicator状态指示

    The chevron direction

04

When to Use

When it fits, and when it doesn't
Collapsible usage recommendations
SituationUse it?
The user only needs to focus on one block at a timeYes
The content is long and opening several at once would blow out the pageYes
The options are related (picking A changes what B means)Yes
Users need to compare multiple entriesNo

If the real need is "see two things at once", mutually exclusive panels keep interrupting the user.

With only one entry, a collapsible turns a simple question into a puzzle.

05

Similar Patterns

Don't mix these up
06

How to tell AI

Three levels of prompt

Add the component name and specifics

Add a single-open collapsible panel: clicking the currently expanded item collapses it, clicking another item switches to that one, and at most one item is expanded at any time.

07

Don't just say this to AI

Bad → Better

Don't say this to AI

Add a collapsible thing where opening one closes the others.

Say this instead

Add a collapsible: keep openIndex in state (nullable), clicking the open item collapses it and clicking another switches to it, at most one panel open at a time, 180ms collapse / 250ms expand height transitions so the two do not overlap and jump.

08

Share this card

Social-ready

Turn this pattern into a 3:4 or 1:1 knowledge card and export it as PNG right in the browser. No backend needed.