-
Notifications
You must be signed in to change notification settings - Fork 9
Component SplitButton
MeowLynxSea edited this page Jun 18, 2026
·
4 revisions
A primary action button with a chevron that opens a dropdown of secondary actions.
use yororen_ui::headless::dropdown_menu::{DropdownMenuItem, DropdownMenuState};
use yororen_ui::headless::split_button::split_button;
let menu_state = DropdownMenuState::new(&mut **cx);
split_button("run", |_, _, _| { /* primary action */ }, cx)
.caption("Run")
.items(vec![
DropdownMenuItem::new("run-debug", "Run with debugger"),
DropdownMenuItem::new("run-profile", "Run with profiler"),
])
.state(menu_state)
.on_select({
let entity = cx.entity();
move |id, _, cx| entity.update(cx, |s, _| s.last_action = id.to_string());
})
.render(cx)| Method | Purpose |
|---|---|
caption(text) |
Primary label. |
items(v) |
Vec<DropdownMenuItem> shown in the dropdown half. |
state(s) |
Entity<DropdownMenuState> (caller-owned). |
on_select(closure) |
Fn(SharedString, &mut Window, &mut App) + 'static + Send + Sync. |
disabled(v) |
Disable both halves. |
Factory takes (id, primary_click, cx) where primary_click is Fn(&ClickEvent, &mut Window, &mut App) + 'static + Send + Sync. .render(cx) returns Stateful<Div>.
See also: Button, DropdownMenu.
Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.