Contents
How does an accordion work in Salesforce Lightning?
A lightning:accordion component displays vertically stacked sections of content that you can expand and collapse. Click a section’s header to expand its content. Users can control how much content is visible at once, and don’t need to scroll as much to see the content of a page. Accordion sections are not lazy loaded.
Can a lightning accordion be opened at a time?
Each lightning-accordion-section can contain HTML markup or Lightning components. By default, only one section can be open at a time. You can close a section by opening another section.
Can a section be expanded in an accordion?
The first accordion section is expanded by default. To change the default, provide a section name using the activeSectionName attribute. The section name is case-sensitive. This example creates a basic accordion with three sections, where section B is expanded by default. Only one accordion section is expanded at a time.
Can you open more than one section in Lightning?
By default, only one section can be open at a time. Close a section by opening another section. You can configure the accordion to allow multiple sections to be open, and then the sections can be opened and closed by clicking section headers. You can specify one or multiple active sections.
Is there a way to automatically refresh Lightning component?
It’s hard. If it’s important, use the Force Streaming API. You did not specify what action at the back end might trigger the refresh, but I’ll assume there is a data change. The Force Streaming API is meant to do this, working around the main technology obstacle that is causing the impedance you encountered.
How to expand a section in Salesforce Lightning?
The onclick handler on the button sets the active section name, which opens the section programmatically. To expand multiple sections programmatically, set allowMultipleSectionsOpen to true and pass in an array of section names instead.