import { LightningElement } from 'lwc'; export default class LightningExampleAccordionBasic extends LightningElement { activeSectionMessage = ''; handleToggleSection(event) { this.activeSectionMessage = 'Open section name: ' + event.detail.openSections; } handleSetActiveSectionC() { const accordion = this.template.querySelector('.example-accordion'); accordion.activeSectionName = 'C'; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter