expandable-section

Toggle visibility of section content

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis risus eget urna mollis ornare vel eu leo. Nulla vitae elit libero, a pharetra augue.

About Expandable Section

Section Titles are interactive titles that open and close sections, typically on a form.

Accessibility

If the Section Title is interactive, the button needs to be associated with the section so that assistive technology knows what the button opens and closes. The button and section also need ARIA attributes to indicate the open and closed state of the section.

Markup

Button:

  • aria-controls is used to create an association between the button and the section. If the section has an id="content", then the button should have aria-controls="content".
  • aria-expanded indicates if the section is open or closed and is read aloud by assistive technology when the button is focused.

Section:

  • aria-hidden indicates if the section is open or closed, and if set to true, assistive technology hides the section.

Keyboard Interactions

  • The button should behave as a normal button. The user should be able to tab to focus it and press enter/space to activate it.

Updating Operation and State

  • When the user interacts with the button to open the section, aria-expanded on the button should be true and aria-hidden on the section should be false.
  • When the user interacts with the button to close the section, aria-expanded on the button should be false and aria-hidden on the section should be true.

Base

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis risus eget urna mollis ornare vel eu leo. Nulla vitae elit libero, a pharetra augue.

<div class="slds-section slds-is-open">
  <h3 class="slds-section__title">
    <button aria-controls="expando-unique-id" aria-expanded="true" class="slds-button slds-section__title-action">

Examples

Non-collapsible

Section Title

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis risus eget urna mollis ornare vel eu leo. Nulla vitae elit libero, a pharetra augue.

<div class="slds-section slds-is-open">
  <h3 class="slds-section__title slds-theme_shade">
    <span class="slds-truncate slds-p-horizontal_small" title="Section Title">Section Title</span>

States

Closed

<div class="slds-section">
  <h3 class="slds-section__title">
    <button aria-controls="expando-unique-id" aria-expanded="false" class="slds-button slds-section__title-action">