<NbAccordion>
<NbAccordionItem title="What a blueprint card is">
A node in a graph.
</NbAccordionItem>
<NbAccordionItem title="What a port is"> One element. </NbAccordionItem>
</NbAccordion>When to use it
Carbon's guidance holds here, and it is mostly about restraint.
- Do use it to shorten a page whose content is not all essential, and to group related detail a reader can choose to open.
- Don't use it when the reader is likely to want everything. An accordion then charges them a click per section for no benefit; a scrolling page with ordinary headings is better.
- Don't use it for nested hierarchy. Reach for
NbTreeinstead.
Content inside a closed panel stays in the DOM, so find-in-page still reaches it. That is deliberate: an accordion is progressive disclosure, not lazy loading. If a section is genuinely expensive, defer it yourself from the toggle event.
One open, or several
By default opening a section closes the last one, which keeps the page short. Set multiple when sections are meant to be compared.
Icons and meta
icon puts a mark before the title; meta puts a count or a status after it, before the chevron.
A hint and actions
info puts an info hint beside the title, for a section whose name alone does not say what belongs in it. The actions slot holds controls that act on the section rather than open it, such as a remove button. Both sit beside the header's button, never inside it, because a button cannot hold another control. A click anywhere else on the row still opens and closes the section.
Flush, for panels and sidebars
flush drops the side inset so titles line up with the content above them, and stops two nearly-touching rule lines appearing where a bordered accordion meets a bordered panel. Hover and focus still reach into the gutter, so a row is still a row.
Sizes
Chevron placement
The chevron sits at the end by default, so every title starts on the same line as the type around it. align="start" puts it in front, which makes the accordion read as a tree; use it only when the content really is hierarchical.