Components: Expansion panel open by default

Created on 10 Sep 2017  ·  12Comments  ·  Source: angular/components

Bug, feature request, or proposal:

I've been searching for a way to open the open expansion panel by default, very little in the documentations, is this possible or shall we raise as a feature request?

Most helpful comment

You can do:

<md-expansion-panel [expanded]="true">
  <!-- Your content here. -->
</md-expansion-panel>

All 12 comments

You can do:

<md-expansion-panel [expanded]="true">
  <!-- Your content here. -->
</md-expansion-panel>

Thanks, perfect!

easy peasy, thanks for the tip.

doesn't that mean it's always expanded? or just initially expanded?

Adding [expanded]="true" to mat-expansion-panel will expand the panel initially. You can still collapse it when you click the toggle header.

is this documented on http://material.angular.io?

Yes in API there is _@ Input_ part where you can see it. Follow the docs @pcnate
https://v5.material.angular.io/components/expansion/api#MatExpansionPanel

how to open mat-expansion in upward direction?

Since merely assigning true, rather than doing anything to it programmatically, this also works:

<md-expansion-panel expanded>
  <!-- Your content here. -->
</md-expansion-panel>

如果是循环md-expansion-panel呢 这样加expanded 会报错 也只默认最后一个是展开的 有遇到这种情况德吗(What if it's a loop called md-expansion panel so expanded will report an error and it will simply expand the last one by default. Is that the case)

How can I expand all the expansion-panel by default? [expanded]="true" only works for one panel whichever is the latest.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelb-01 picture michaelb-01  ·  3Comments

vanor89 picture vanor89  ·  3Comments

kara picture kara  ·  3Comments

jelbourn picture jelbourn  ·  3Comments

3mp3ri0r picture 3mp3ri0r  ·  3Comments