Skip to content

Sections

Stable

A long answer in foldable sections that open as they stream in.

Also known as accordion, collapsible sections, expandable sections, faq

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

While the answer streams

Montmartre is quiet in the evenings; the Marais is closer to the museums. Both are 20 minutes from the station.

Each new section opens as it arrives, then the answer settles on the first.

When to use it

Keeps a long, structured answer short to scan, without hiding where the answer is while it is still being written.

Made of: Section heading · Short line · Chevron · Section content

Use it for

  • Trip plans, reports and comparisons with clear parts.
  • Answers that stream in part by part.

Not for

  • One section that people open and close: use Collapsible.
  • The assistant's reasoning, shown on request: use ThinkingBlock.
  • Steps the assistant is working through: use PlanCard.

Do and avoid

Fri 8:10 out, Sun 19:40 back.

Do. Clear titles, the first part open, the rest a tap away.

Fri 8:10 out, Sun 19:40 back.
Avoid. One vague fold hides a short answer that should just be shown.

Do

  • Use a few sections with clear titles.
  • Keep ids stable while streaming.
  • Let the person's choice win once they open or close one.

Avoid

  • Do not fold an answer of one or two short paragraphs.
  • Do not move sections after the person has opened one.
  • Do not hide the only important part in a folded section.

On a phone

  • Titles wrap; the short line moves under the title when there is no room.
  • Each heading is a full-width button, easy to tap.

Seen in products

  • OpenUI's SectionBlock opens each new section as it streams in and folds back to the first when the answer ends, unless the person has already clicked.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started