Menu icon indicating copy to clipboard operation
Menu copied to clipboard

Menu images?

Open ZedZipDev opened this issue 4 years ago • 7 comments

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");
    }
}

ZedZipDev avatar Jan 23 '20 07:01 ZedZipDev

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.

chrissainty avatar Jan 24 '20 08:01 chrissainty

Thank you @chrissainty , it will be good feature

ZedZipDev avatar Jan 24 '20 18:01 ZedZipDev

@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.

ThaRaven403 avatar Jul 02 '20 13:07 ThaRaven403

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 avatar Jul 04 '20 11:07 chrissainty

@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 avatar Jul 04 '20 13:07 ThaRaven403

@ThaRaven403 Sounds good. I'm happy for you to take the lead on this if you want to?

chrissainty avatar Jul 06 '20 07:07 chrissainty

@chrissainty I'd be glad to!

ThaRaven403 avatar Jul 06 '20 13:07 ThaRaven403