I am using version 8.2.2 (react), demo 7.
I would like your help to make the secondary display of the aside start closed and open and close whenever I click on the tab icon and not by the button #kt_aside_toggle.
If possible, I would also like help to make the secondary display automatically close whenever I click outside the menu.
Thank you in advance for your attention.
Hi,
Thank you for reaching out to us.
You can toggle the secondary sidebar programmatically using ToggleComponent instance as shown below.
const toggleSecondarySidebar = () => {
const toggleEl = document.getElementById("kt_aside_toggle");
if(toggleEl) {
const toggleComponent = DataUtil.get(toggleEl, "toggle") as ToggleComponent;
toggleComponent?.toggle();
}
}
<button type="button" onClick={toggleSecondarySidebar}>Toggle Secondary Sidebar</button>