[Idea] NbMenuItem: Easier hiding of dynamic menu items
- 主要语言
- TypeScript
- 星标
- 8.1k
- 派生
- 1.5k
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Issue type
**I'm submitting a ...** (check one with "x")
* [ ] bug report
* [ x ] feature request
### Issue description
**Current behavior:**
Right now it's somewhat difficult to manage menu items that you want to show only in certain situations. Specifically, I'm referring to the sidebar.
The NbMenuItem class allows you to specify if an element is hidden, but it doesn't seem to have a two way binding that would allow it to update when the passed in value changes.
One option I found is to use the theme service to listen for break point changes, then update your menu item array but that's not great.
**Expected behavior:**
A common scenario would be you want to hide group entries from the collapsed state of the sidebar menu. Failure to do so leaves a noticeable gap, like so:

Another scenario is if you want to move things from the header into the sidebar as the break points collapse.
**Related code:**
Possible solutions:
- Add a class property to NbMenuItem which would allow the use of bootstrap display utility classes to show/hide things on certain breakpoints. ie: d-sm-none, d-md-flex, etc (this is probably the easiest way)
- Two way binding on the hidden property
- add a methods to NbMenuService for toggling items
贡献指南
评估
这个 Issue 还没有评估数据。