M Majid DS mds
GitHub

Flux components

Dropdown

A menu of actions or options, anchored to a trigger.

The previews on this page are live — open them.

<flux:dropdown>
    <flux:button icon:trailing="chevron-down">Order actions</flux:button>

    <flux:menu>
        <flux:menu.item icon="eye">View details</flux:menu.item>
        <flux:menu.item icon="printer">Print invoice</flux:menu.item>
        <flux:menu.separator />
        <flux:menu.item icon="trash" variant="danger">Cancel order</flux:menu.item>
    </flux:menu>
</flux:dropdown>

Position and align

align is logical — start and end follow the reading direction. position takes physical sides (top, right, bottom, left).

<flux:dropdown position="top" align="end">
    <flux:button icon:trailing="chevron-up">Opens upward</flux:button>

    <flux:menu>
        <flux:menu.item>Newest</flux:menu.item>
        <flux:menu.item>Cheapest</flux:menu.item>
    </flux:menu>
</flux:dropdown>

Checkboxes and radios

A menu can hold state instead of only actions.

In stock
Free shipping
Discounted
<flux:dropdown>
    <flux:button icon="funnel" icon:trailing="chevron-down">Filters</flux:button>

    <flux:menu>
        <flux:menu.checkbox checked>In stock</flux:menu.checkbox>
        <flux:menu.checkbox>Free shipping</flux:menu.checkbox>
        <flux:menu.checkbox>Discounted</flux:menu.checkbox>
    </flux:menu>
</flux:dropdown>

Groups and headings

Account
<flux:dropdown>
    <flux:button icon:trailing="chevron-down">Account</flux:button>

    <flux:menu>
        <flux:menu.group heading="Account">
            <flux:menu.item icon="user">My profile</flux:menu.item>
            <flux:menu.item icon="shopping-bag" kbd="⌘O">My orders</flux:menu.item>
        </flux:menu.group>

        <flux:menu.separator />

        <flux:menu.item icon="arrow-right-start-on-rectangle" variant="danger">Sign out</flux:menu.item>
    </flux:menu>
</flux:dropdown>

Reference

flux:dropdown

PropDescription
positionOptions: top, right, bottom, left. Default: bottom.
alignOptions: start, center, end. Default: start.
gapPixel gap between trigger and panel. Default: 5.
offsetPixel shift along the aligned edge. Default: 0.
hoverOpens on hover instead of click.

flux:menu

The panel for action items.

flux:menu.item

PropDescription
iconLeading icon name.
icon:trailingTrailing icon name.
icon:variantIcon variant. Default: mini.
variantOptions: danger. Default: default.
kbdKeyboard shortcut hint on the trailing edge.
suffixExtra content on the trailing edge.
valueValue for checkbox and radio items.
hrefRenders the item as a link.

flux:menu.submenu

PropDescription
headingSubmenu label.
iconLeading icon name.
keep-openKeeps the parent menu open on select. Default: false.

flux:menu.separator

A dividing line between items.

flux:menu.group

PropDescription
headingGroup label above the items.

flux:menu.checkbox

A menu item with a checkbox. Takes checked, value, wire:model.

flux:menu.radio

A menu item with a radio. Takes checked, value, wire:model.

Related