Menu
Menu copied to clipboard
Menu images?
How to use images in menu like menu in the VS2019 Blazor default app?
i.e. how to add images in this sample?
<BlazoredMenu MenuBuilder="@MenuBuilder" />
@functions {
MenuBuilder MenuBuilder = new MenuBuilder();
protected override void OnInit()
{
MenuBuilder.AddItem(1, "Home", "/")
.AddSubMenu(2, "Sub Menu", new MenuBuilder().AddItem(1, "Counter", "counter")
.AddItem(3, "FetchData", "fetchdata");
}
}
We don't have support for this feature right now. But I can add it to the backlog, this library needs some time spent on it but I've just not had the chance for a while.
Thank you @chrissainty , it will be good feature
@chrissainty did you have an idea of how images could be integrated?
A first step could be to support a string specifying the icon class(es) to use that would add a span. But I could see this going in all directions with custom markup, svg images, and so on...
There's also the question of positioning the icon. Again, default could be on the left of the text, but customization could go far here also.
I'd be interested in working on this one (more work than small bug fixes for a change 😂), but I'd like to confirm your vision on this.
Hey @ThaRaven403 - If I'm honest I've not had the chance to give it any thought. This library is in desperate need of some TLC and probably needs a full redesign as it's not really been touched since I built it. Do you have any thoughts on it?
@chrissainty Maybe going full blown on the builder pattern would help. With individual builder properties for each of the menu settings, it would then be easy to then build it using a certain logic depending on what options you set. Like with any builder, someone could go and add a SVG and icon class for example, but the build method could manage that and the behavior would be self explanatory.
And with that in place, it would be easy to add new features without revamping the whole thing; only a new builder method, the implementation in the Build and the HTML.
(edited to tag you, didn't know if notifications are going through)
@ThaRaven403 Sounds good. I'm happy for you to take the lead on this if you want to?
@chrissainty I'd be glad to!