Collapsible

@sushindustries/ui

One details, dressed - a sentence that opens, for prose rather than lists.

4 min read
View as MarkdownEdit on GitHub

Collapsible is a single <details> element dressed with a summary line and a chevron, for one expandable sentence or paragraph inside prose. Reach for Accordion instead once there is a list of several items that should each be able to open independently.

Viewport width
Phone22remthe floor, the narrowest this promises to work at
tanstacktanstack add https://adamjurek.com/r/tanstack/collapsible.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/collapsible.json

Why it is built this way

It is a separate component from Accordion rather than an accordion of one item, because the composed component imposes a list shape that a single line inside a paragraph does not want. A collapsible inside prose is a sentence that opens, not a stack of one.

What it does not do

After the first paint, defaultOpen does not force anything - it only seeds the initial state, and the reader's own toggle stands after that. There is no controlled open prop or callback for tracking state from outside.

Install commands are not written here

Anything in packages/ui/registry.ts gets its TanStack and shadcn commands attached automatically, so there is nothing to keep in sync.

Install

tanstack add https://adamjurek.com/r/tanstack/collapsible.json
shell
pnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/collapsible.json
shell
pnpm add @sushindustries/ui @sushindustries/atoms
shell

What you get

Version0.1.0
Categorylayout · Disclosure
Filescollapsible.tsx
DependenciesNone
Also installsiconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content
Tagsdetails, no-deps

No runtime dependencies

It brings nothing with it beyond the stylesheet.

UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content
Mentioned inAccordion