function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

show and hide Accordion

Hey guys anyone have idea about how can i show and hide my accordion row at a time using SLDS
here is my component and controller
            <aura:attribute name="showEditable" type="Boolean" default = "false"/>
            <aura:attribute name="showReadable" type="Boolean" default = "true"/>

    <aura:attribute name="accountList" type="Account[]"/>
        <aura:attribute name="isexpanded" type="Boolean"/>

    <aura:handler name="init" value="{! this }" action="{! c.doInit }"/>

      <lightning:card title = "Account Accordian" variant = "narrow">
          <ul class="slds-accordion">
              <aura:iteration items="{!v.accountList}" var="account">
                      <div class="slds-page-header" style="cursor: pointer;" id="{!account.Id}"  data-record="{!idx}" onclick="{!c.expand}" >
                          <section class="slds-clearfix">
                              <div class="slds-float--left ">
                                  <div class="slds-m-left--large">{! account.Name}</div>
                          <div class="slds-hide slds-p-around--medium"  id="{!account.Id}" aura:id="{!account.Id}">
                              Account details
                              <aura:if isTrue="{! v.showReadable}">
                                  <c:AccountDetailsComponent recordId="{! account.Id}"/>
                                  <lightning:button variant="brand" label="Edit" onclick="{! c.EditShow }" />
                              <aura:if isTrue="{! v.showEditable}">
                                  <c:editableRecordLDS recordId="{! account.Id}"/>
    expand : function(component,event) {
         var currentElementId = event.currentTarget.getAttribute("id");;  
        console.log("Element Id-> ",currentElementId);
        var acc = component.find(currentElementId.toString());
	  var acc1 = document.getElementById(currentElementId);

           /* for(var cmp in acc1) {
        	$A.util.toggleClass(acc[cmp], 'slds-show');  
        	$A.util.toggleClass(acc[cmp], 'slds-hide');  
             $A.util.toggleClass(acc1, 'slds-is-open');
    doInit : function(component, event, helper) {
        var action=component.get('c.getAccountList');
            var state = response.getState();
            console.log('state ='+state);
            if (component.isValid() && state === "SUCCESS") {
                component.set("v.accountList", response.getReturnValue());
  EditShow : function(component, event, helper) {



Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Rahul,
You can use lightning accordian for this.
Please refer below links which might help you in this.

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards
movie apkmovie apk
This code is not working on my own website can anybody help me.

​​​​​​​​​​​​​​ (
Aman PathakAman Pathak
Hi , I hope you have gone through the existing component Library.
Apprach is already present, no neet to make a  custom one.