- Organization Components
- Accordion Scope
Organization Components
Accordion Scope
Expand or collapse multiple accordions with a shared control, even across separate groups.
Wrap AccordionControls and the accordions it should manage in AccordionScope.
The control displays Expand all while any accordion in the scope is closed,
and Collapse all when every accordion in that scope is open.
AccordionScope does not add a visual container. Use
AccordionGroup inside it when you want to group
accordions visually.
Add scope and control wrappers in your page’s MDX source, using the CLI or a source editor. The visual editor does not yet support editing these wrappers.
One control across multiple groups
The first accordion starts open. Expand all opens the remaining accordions; Collapse all closes every accordion in this scope. You can still open and close each accordion individually.
<AccordionScope>
<AccordionControls />
<AccordionGroup>
<Accordion id="scope-install" title="Install the CLI" defaultOpen>
Install the DocsAlot CLI before working with your documentation locally.
</Accordion>
<Accordion id="scope-preview" title="Preview your changes">
Open a local preview to check content and navigation before publishing.
</Accordion>
</AccordionGroup>
<AccordionGroup>
<Accordion id="scope-publish" title="Publish your documentation">
Push the reviewed changes and publish the version you want readers to see.
</Accordion>
<Accordion id="scope-verify" title="Check the live site">
Open the published pages and confirm that their links work.
</Accordion>
</AccordionGroup>
</AccordionScope>
Independent scopes and custom labels
This second scope is independent of the example above. Its Show all answers
control only opens the account question below. The controls above do not change
it. Set expandLabel and collapseLabel to match your content or language.
<AccordionScope>
<AccordionControls expandLabel="Show all answers" collapseLabel="Hide all answers" />
<Accordion id="scope-account" title="Where can I manage my workspace?">
Sign in to DocsAlot and select the workspace you want to manage.
</Accordion>
</AccordionScope>
Scope behavior
- A control affects accordions in its nearest
AccordionScope, across any groups inside that scope. - Nested accordions belong to the same scope unless you wrap them in a separate
AccordionScope. A nested scope has independent controls. - Accordions outside a scope are unaffected by its controls.
defaultOpenstill sets each accordion’s initial state. Individual toggles and direct links update the control’s label to match the current state.- Controls are hidden outside a scope or when the scope contains no accordions.
You do not need click handlers or custom JavaScript for these controls.
AccordionScope properties
The content containing your accordions, groups, and controls. The scope itself has no visual styling or additional authoring properties.
AccordionControls properties
The button label when at least one accordion in the scope is closed. Clicking the button opens all accordions in that scope.
The button label when every accordion in the scope is open. Clicking the button closes all accordions in that scope.
