Collapsible

@sushindustries/ui

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

4 min read
View as MarkdownEdit on GitHub

Props

PropTypeDefaultDoes
summaryReactNode-The always-visible line. A node rather than a string, so a section can put its own icon beside its name. It was a string, which forced every caller that wanted one to give up the component and hand-roll a <details> - which is the shape of a prop that is one type too narrow. Keep it to a line. This is a summary element: it is the click target and the thing a screen reader announces for the whole section, so a paragraph in here is a paragraph read out before anything else.
childrenReactNode-
defaultOpen?boolean-Open on the first paint. After that the reader's toggle stands - nothing re-forces it.

Notes

There is no controlled mode - defaultOpen sets the state for the first render only, matching AccordionAccordiondetails, stacked - every behaviour ships in the element, and items open independently on purpose.@sushindustries/ui · layout. summary is plain text, not a ReactNode; anything that needs markup in the always-visible line belongs in a custom <details> built by hand, not through this component.

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