lwc custom accordion expandable/collapsible section -- w3web.net

How to create custom expandable/collapsible accordion section uses of lightning-accordion tags in Lightning Web Components — LWC

Hey guys, today in this post we are going to learn about how to create custom expandable/collapsible accordion section uses of lightning-accordion tags in LWC (Lightning web components).

Here I am display a vertically lightning-accordion sections of content that you can expand and collapse.

Click a section’s vertically tab to expand its related content. You can control the visible only one section at a time.

Files we used in this post example

lwcAccordionSection.html Lightning Web Component HTML Template HTML file for used to write HTML element for user interface.
lwcAccordionSection.js Lightning Web Component JavaScript It is holding onclick functionality for Create Custom Expandable/Collapsible Section.
lwcAccordionSection.js-meta.xml XML Meta File It is used for where this lightning web component you want to exposed.
lwcAccordionSection.css Style CSS File It is used for fixed the alignmet issues of Expandable/Collapsible box and Image.

Final Output

custom accordion section in lwc -- www.w3web.net

Other related post that would you like to learn in LWC

Create Lightning Web Component HTML

Step 1:- Create Lightning Web Component HTML ➡ lwcAccordionSection.html

SFDX:Lightning Web Component ➡ New ➡ lwcAccordionSection.html

lwcAccordionSection.html [Lightning Web Component HTML]

Create Lightning Web Component Javascript

Step 2:- Create Lightning Web Component Javascript ➡ lwcAccordionSection.js

SFDX:Lightning Web Component ➡ New ➡ lwcAccordionSection.js

lwcAccordionSection.js [LWC JavaScript File]

Create Lightning Web Component Meta XML

Step 3:- Create Lightning Web Component Meta XML ➡ lwcAccordionSection.js-meta.xml

SFDX:Lightning Web Component ➡ New ➡ lwcAccordionSection.js-meta.xml

lwcAccordionSection.js-meta.xml [LWC Meta Data XML]

Create Lightning Web Component Style CSS

Step 4:- Create Lightning Web Component Style CSS ➡ lwcAccordionSection.css

SFDX:Lightning Web Component ➡ New ➡ lwcAccordionSection.css

lwcAccordionSection.css [Style CSS]

Create Lightning Application

Step 5:- Create Lightning Application : lwcAccordionSectionApp.app

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

lwcAccordionSectionApp.app [Component Application File]

lwc custom accordion expandable/collapsible section -- www.w3web.net

Further post that would you like to learn in LWC

7 thoughts on “How to create custom expandable/collapsible accordion section uses of lightning-accordion tags in Lightning Web Components — LWC”

Leave a Comment