I’m looking for a JavaScript menu bar widget that allows menu items to be added and removed dynamically. I’m already loading jQuery and jQueryUI, so any library that builds on those libraries is preferable to one that requires another underlying framework. A lightweight library with few dependencies is OK too.
The jQueryUI mebubar widget seems to have the functionality that I need (menu bar, sub-menu support, presumably theme-able) except the ability to add and remove menu items easily. I’ve started looking into how to hack this ability into this widget, but it’s turning out to be more complicated than I expected. A library that already has this feature would be easier. (Failing that, perhaps I’ll open another question asking how to best hack this widget.)
So, to sum up what I’m looking for:
- JavaScript pull-down menubar widget (click to pull down a menu)
- Sub-menu support
- Customizable appearance
- Arbitrary JavaScript hooks to run when a menu item is selected
- Builds on jQuery and/or jQueryUI, or is lightweight/independent
- Allows menu items to be added or removed dynamically
- License allows commercial use
- Accessibility and keyboard support would be nice
Kendo UI includes a nice menu widget: http://demos.kendoui.com/web/menu/index.html. The API looks fairly robust and simple.
The only thing I see missing that you noted is keyboard navigation – also note that there is a cost to use it in commercial projects.