-1

I'm having an accordion with 3 expansion panels. I want to keep at least one panel open always. i.e, I don't want the user to close all the panels.

How to achieve this?

Thanks in advance.

code
  • 11
  • 5

1 Answers1

0

You can use [expanded] property available in mat-accordion. Add the below code in the mat-expansion-panel tag

[expanded]="true"
Kushal Bajje
  • 121
  • 1
  • 8
  • It works only for the first time, my use case is, when the user collapses one panel, the next one should open up. One of the three should always be open. – code Oct 20 '21 at 16:30
  • For this case you can use [expanded]=some_variable for all three expansion panel, and add click event listener to the expansion panel and toggle the state. – Kushal Bajje Oct 21 '21 at 11:35