fluentui-blazor icon indicating copy to clipboard operation
fluentui-blazor copied to clipboard

Menu Button: Appearance Parameter

Open Rocky-25 opened this issue 2 years ago • 3 comments

🙋 Feature Request

Can Menu button be updated to allow Appearance to be passed so it's not always accent?

Rocky-25 avatar Feb 27 '24 16:02 Rocky-25

There are several Appearance available: https://fluentui-blazor.net/button The menu is linked to the button using Anchor.

    <FluentButton>Button</FluentButton>
    <FluentButton Appearance="Appearance.Accent">Accent</FluentButton>
    <FluentButton Appearance="Appearance.Lightweight">Lightweight</FluentButton>
    <FluentButton Appearance="Appearance.Outline">Outline</FluentButton>
    <FluentButton Appearance="Appearance.Stealth">Stealth</FluentButton>
    <FluentButton BackgroundColor="var(--highlight-bg)" Color="var(--info)">Colored</FluentButton>
    <FluentButton Loading="@loading" OnClick="@StartLoadingAsync" Appearance="Appearance.Accent">Loading</FluentButton>

image

dvoituron avatar Feb 27 '24 17:02 dvoituron

Hi,

Thanks, I know I can restyle a button, but your MenuButton component doesn't allow this for some reason? Why can't the appearance be passed here too rather than hard coded to Appearance.Accent?

<div class="fluent-menubutton-container">
    <FluentButton @ref="Button" Appearance="Appearance.Accent" Style=@ButtonStyle aria-haspopup="true" aria-expanded="@_visible" @onclick=ToggleMenu @onkeydown=OnKeyDown>
        @Text
        <FluentIcon Value="@(new CoreIcons.Regular.Size24.ChevronDown())" Slot="end" Color="@Color.Fill" />
    </FluentButton>
    <FluentMenu @ref="Menu" aria-labelledby="button" Style="@MenuStyle" @bind-Open=@_visible @onmenuchange=OnMenuChangeAsync>
        @foreach (KeyValuePair<string, string> item in Items)
        {
            <FluentMenuItem Id="@item.Key">@item.Value</FluentMenuItem>
        }
    </FluentMenu>
</div>

I could create my own version of a button and menu like your page but then why does MenuButton exist?

Rocky-25 avatar Feb 28 '24 09:02 Rocky-25

Oh. I hadn't understood that. Indeed it could be interesting

dvoituron avatar Feb 28 '24 09:02 dvoituron