nebular
nebular copied to clipboard
feature request: make items in nebular menu disabled
Issue type
I'm submitting a ...
- [ ] bug report
- [x] feature request
Issue description
Current behavior: It is not currently possible to set menubar items as disabled
Expected behavior: Should be possible to set menu items as disabled. click handler should work as before but it should be possible to know that the clicked item is actually disabled.
Angular, Nebular
"@angular/core": "~8.2.14",
"@nebular/theme": "4.6.0"
I would like to do something like this:
ngOnInit() {
// listen for item clicks
this.menuService.onItemClick()
.pipe(
filter(({ tag }) => tag === 'menu'),
)
.subscribe(event => {
if (event.item.disabled) {
console.log('disabled -> handle it differently')
} else {
console.log('item enabled -> title = ' + event.item.title);
}
});
}
hi, I had this issue and just did workaround for it.
<nb-menu [ngStyle]="{'pointer-events':condition? 'none' : 'auto'}"
[ngClass]="{'disabled-item':condition}" [items]="menu" autoCollapse="false"></nb-menu>
and in scss file :
::ng-deep nb-menu.disabled-item a {
opacity: 0.3;
}