accordion
accordion creates panels with content that can be collapsed and expanded.
XML Element |
|
|---|---|
Java Class |
|
Basics
Use accordion to group or hide similar content. Content is placed in nested accordionPanel elements. There can be multiple such panels, but only one can be expanded at a time.
The live sample defines two panels. The focused snippet shows the panel containing a form; its summaryText remains visible while the nested content is collapsed:
<accordion id="mainAccordion" height="100%" width="100%">
<accordionPanel summaryText="Panel with FormLayout">
<formLayout>
<textField label="Field 1"/>
<textField label="Field 2"/>
<textField label="Field 3"/>
</formLayout>
</accordionPanel>
</accordion>
Theme Variants
Use the themeNames attribute to set a component theme.
| Variant | Description | Supported By |
|---|---|---|
|
Applies a filled background style to the panel. |
Aura, Lumo |
|
Displays the toggle icon after the summary text. |
Aura, Lumo |
|
Makes the panel smaller. |
Aura, Lumo |
|
Removes the default padding from the content area. |
Aura |
Attributes
Common attributes apply to both accordion and accordionPanel. The following attributes are specific to accordionPanel:
| Name | Description | Default |
|---|---|---|
Controls whether the panel is expanded. |
|
|
Sets the summary that remains visible when the panel is collapsed. |
— |
Handlers
The same handlers can be configured on accordion and accordionPanel.
| Name | Description |
|---|---|
Fires when the component is attached to the UI. |
|
Fires when the component is detached from the UI. |
|
Fires when a panel is expanded or collapsed. A handler on |
Elements
An accordion contains one or more accordionPanel elements. Each panel accepts one or more components or layouts as its content.