How to Create Custom Accordion Expand, Collapse and Toggle Section in Lightning Component

Vijay Kumar
2 min readAug 22, 2020

Hey guys, today in this post we are going to learn about how to create a custom accordion Expand Collapse and Toggle section using JavaScript in Salesforce lightning component.

Files we used in this post example:-

customAccordionApp.app

Lightning Application

It is used for call the component to preview on browser.

customAccordionCmp.cmp

Lightning Component

It is used for create a accordion list item section.

customAccordionCmpcontroller.js

Lightning Component Controller

It is used for click functionality that is Expand Collapse and Toggle section in Lightning component.

customAccordionCmp.CSS

Component Style CSS

It is used for create custom Style CSS for Expandable/Collapsible & Toggle (Accordion) section.

Final Output

Other post that would you like to learn

Step 1:- Create Lightning Application : customAccordionApp.app

From Developer Console >> File >> New >> Lightning Application

customAccordionApp.app [Component Application File]

Step 2:- Create Lightning Component : customAccordionCmp.cmp

From Developer Console >> File >> New >> Lightning Component

customAccordionCmp.cmp [Lightning Component File]

Step 3:- Create Lightning Component : customAccordionCmpcontroller.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

customAccordionCmpcontroller.js [JavaScript Controller]

Step 4:- Create Lightning Component Style: customAccordionCmp.CSS

From Developer Console >> File >> New >> Lightning Component >> Component Style CSS

customAccordionCmp.CSS [Style CSS]

Originally published at https://www.w3web.net on August 22, 2020.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response