Skip to content
HomeCobalt

Collapsible

A row that opens under itself to the details it holds, so a list, a card or a page can keep what you read only sometimes one press away.

Examples

Each run opens to its details, and the runs below it make room.
In a cardA line of a card opens to the services behind its total, and the card grows with it.
Cloud spend, October
$56,145 of a $52,210 budget
In a sectionQuestions under a section heading, each opening to its answer.

Questions

Usage

Use it when

  • A row of a list holds details you read sometimes, such as a run's figures: each row opens on its own, and the rows below make room.
  • A line of a card or a section stands for a longer list, such as a total for the items behind it.
  • A question holds an answer of a paragraph or two.

Use something else when

  • Several views of one subject sit side by side. Use Tabs instead.
  • The answer is a menu of actions. Use DropdownMenu instead.
  • A button opens one small field, such as a name to save. Use Grow instead, which turns the button into the form.
  • The answer needs your decision before you go on. Use Dialog instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/collapsible.json
import { Collapsible, CollapsibleChevron, CollapsiblePanel, CollapsibleTrigger } from "@/components/cobalt/ui/collapsible"