Skip to content
All components

Components

Menu

The menu is a small outlined button with a chevron; pressing it opens a popover under it with one link per item. Every item is a plain address, so the menu works without script and a choice is a page load. Esc or a click outside closes it.

Actions

A short list of links under its button.

Menu {
    id: "menu-row",
    label: "Actions",
    items: &[
        ("Open", "#open"),
        ("Duplicate", "#duplicate"),
        ("Export CSV", "#export"),
    ],
}

Account

Menus name where each row goes.

Menu {
    id: "menu-me",
    label: "Maya Chen",
    items: &[
        ("Account", "#account"),
        ("Billing", "#billing"),
        ("Sign out", "#sign-out"),
    ],
}

Views

Two or three rows are enough for a menu.

Menu {
    id: "menu-view",
    label: "View",
    items: &[("Table", "#table"), ("Board", "#board")],
}

On the Mac

The same vocabulary drawn by Ocean UI's native face (egui on Metal), as the gallery's snapshot.

Menu drawn by Ocean UI's native face, darkMenu drawn by Ocean UI's native face, light

Use it

Web

use ocean_ui_web::{Menu, to_html};
to_html(&Menu { id: "more", label: "More", items: &[("Export", "/export"), ("Settings", "/settings")] })

Native

use ocean_ui_native::{containers::{Menu, MenuItem}, egui::Id};
let items = vec![MenuItem::new("Copy link", "chat.copy"), MenuItem::new("Delete", "chat.delete").danger(true)];
let picked = Menu { id: Id::unique("gallery.menu"), items }.show(ui, &anchor);

Cargo feature base of ocean-ui-core, ocean-ui-web and ocean-ui-native; available since 2026-10-29.

Props

NameTypeDefaultWhat
id&str—The panel's id; the button names it with popovertarget.
label&str—The words on the button.
items&[(&str, &str)]—The rows as (label, href) pairs, in the order shown.

Accessibility

  • The button says aria-haspopup="menu", and the panel is role="menu" with one menuitem link per row.
  • The panel is the browser's popover, so Esc or a click outside closes it.
  • Items are links that Tab moves through; there is no arrow-key movement between them.

Related

Markdown

The same page as Markdown, for an agent or a pull request.

Search

esc

Components

Blocks

Screens built from blocks

The Ocean app

Ocean Base console