Skip to content

Commit 27b010c

Browse files
authored
[Docs] Collapse menu items (#302)
I've just copied the recent change on Sylius documentation side, cause it's not documented here too. On Sylius documentation <img width="840" height="275" alt="image" src="https://github.com/user-attachments/assets/9fef7106-96f5-44ef-851d-b75d4e2a6a39" /> On Sylius stack documentation preview <img width="840" height="275" alt="image" src="https://github.com/user-attachments/assets/539bc3c8-c8eb-4ba4-bc2e-5bcfa50f1ad2" />
2 parents ee84863 + f0cccc6 commit 27b010c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/cookbook/admin_panel/menu.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,19 @@ final readonly class MenuBuilder implements MenuBuilderInterface
8888
}
8989
}
9090
```
91+
92+
{% hint style="success" %}
93+
**🧠 Collapse your custom menu by default**
94+
95+
It's possible to expand your parent menu category on page load by default. For that, you have to set the `setExtra` attribute like this:
96+
97+
```php
98+
$library = $menu
99+
->addChild('library')
100+
->setLabel('app.ui.library')
101+
->setLabelAttribute('icon', 'tabler:books')
102+
->setExtra('always_open', true);
103+
```
104+
105+
However, ensure that you set the attribute in the parent menu, not in one of the child menu items.
106+
{% endhint %}

0 commit comments

Comments
 (0)