Skip to main content

Menu

Function Menu 

Source
pub fn Menu(_: MenuProps) -> Element
Expand description

A menu of actions anchored to a trigger. Like a desktop dropdown menu.

Arrow keys, Home, and End move between items; Escape closes the menu. Choosing an item closes it.

rsx! {
    Menu { open,
        trigger: rsx! {
            Button { fill: ButtonFill::Clear, aria_label: "More", aria_haspopup: "menu",
                aria_expanded: open().to_string(), onclick: move |_| open.toggle(), Ellipsis {} }
        },
        MenuItem { onclick: move |_| rename(), "Rename" }
        MenuItem { color: Color::Danger, onclick: move |_| delete(), "Delete" }
    }
}

ยงProps

For details, see the props struct definition.

  • open : Signal<bool>

    Whether the menu is open.

  • trigger : Element

    The element the menu is anchored to.

  • placement : Option<PopoverPlacement>

    Where it opens. Defaults to PopoverPlacement::BottomStart.

  • aria_label : Option<String>

    Accessible name of the menu.

  • mode : Option<ComponentMode>

    Platform look. Defaults to the ambient mode.

  • class : Option<String>

    Extra classes for the menu panel.

  • children : Element