Skip to main content

euv_ui/component/dropdown/view/
struct.rs

1use super::*;
2
3/// One entry of the [`euv_dropdown`] menu.
4///
5/// Carries the display label and the opaque value handed to `on_select`.
6#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
7pub struct EuvDropdownItem {
8    /// The display label.
9    #[get(type(copy))]
10    pub label: &'static str,
11    /// The opaque value passed to the select callback.
12    #[get(type(copy))]
13    pub value: &'static str,
14}
15
16/// Props for the [`euv_dropdown`] component.
17///
18/// The open state is owned by the caller so the trigger (passed as children)
19/// can toggle it; selecting an item closes the menu.
20#[derive(Clone, CustomDebug, Default)]
21pub struct EuvDropdownProps {
22    /// The open state signal toggled by the trigger children.
23    pub open: Signal<bool>,
24    /// The menu items.
25    pub items: Vec<EuvDropdownItem>,
26    /// Optional select callback receiving the chosen item value.
27    #[debug(skip)]
28    pub on_select: Option<Rc<dyn Fn(&'static str)>>,
29}