Expandable Section
Expandable Section
- HTML/CSS:Dev Ready
- Layout:Responsive
Toggle visibility of section content
Base
Preview
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.
Notable attributes
Button:
aria-controlsis used to create an association between the button and the section. If the section has anid="content", then the button should havearia-controls="content".aria-expandedindicates if the section is open or closed and is read aloud by assitive technology when the button is focused.
Section:
aria-hiddenindicates if the section is open or closed, and if set totrue, assistive technology hides the section.
Keyboard navigation
- 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-expandedon the button should betrueandaria-hiddenon the section should befalse. - When the user interacts with the button to close the section,
aria-expandedon the button should befalseandaria-hiddenon the section should betrue.
Overview of CSS Classes
- Selector
- The CSS class being referred to.
- Summary
- A description of what the class does.
- Support
- Whether the class name is dev-ready (meaning it's fully vetted and tested and safe to use) or prototype (which means it's not fully vetted yet).
- Restrict
- The selector that the class name is allowed to be used on.
- Variant
- The base level pattern for a component. A variant can be extended to create another variant of that component, for example, a stateful button is a derivative of the base button.
- Modifier
- A single class that can be added to an HTML element of a component to modify its output. Typically these will be colors, sizing and positioning.
| Selector | .slds-section |
|---|---|
| Summary | Container for a expandable section |
| Support | dev-ready |
| Restrict | article, div |
| Variant | True |
| Selector | .slds-section__title |
|---|---|
| Summary | Element containing the title of a section |
| Restrict | .slds-section h3 |
| Selector | .slds-section__title-action |
|---|---|
| Summary | Element containing the action inside of an expandable section title |
| Restrict | .slds-section__title button |
| Selector | .slds-section__content |
|---|---|
| Summary | Element containing the content of an expandable section |
| Restrict | .slds-section div |
| Selector | .slds-is-open |
|---|---|
| Summary | Toggle visibility of section content |
| Restrict | .slds-section |
| Modifier | True |