1. Organization Components
  2. Accordion Scope

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.

Install the DocsAlot CLI before working with your documentation locally.

Shared controls across groups
<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.

Independent controls
<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.
  • defaultOpen still 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

children
required
Markdown or components

The content containing your accordions, groups, and controls. The scope itself has no visual styling or additional authoring properties.

​
AccordionControls properties

expandLabel
default:Expand all
string

The button label when at least one accordion in the scope is closed. Clicking the button opens all accordions in that scope.

collapseLabel
default:Collapse all
string

The button label when every accordion in the scope is open. Clicking the button closes all accordions in that scope.

​
Desktop example

Shared accordion controls above installation and publishing groups

One control can manage accordions across multiple groups.