Skip to main content

euv_ui/component/button_group/view/
struct.rs

1use super::*;
2
3/// Props for the `euv_button_group` component.
4///
5/// A group joins the buttons it holds into one control, so the inner
6/// borders between the buttons are dropped and only the outer frame
7/// remains.
8#[derive(Clone, CustomDebug, Data, Default, New)]
9pub struct EuvButtonGroupProps {
10    /// The direction the group is laid out in.
11    #[get(type(copy))]
12    pub orientation: EuvButtonGroupOrientation,
13}
14
15/// Props for the `euv_button_group_text` component.
16///
17/// The text sits between two buttons and takes their height, so a group
18/// reads as one row even when it mixes a label with its actions.
19#[derive(Clone, CustomDebug, Data, Default, New)]
20pub struct EuvButtonGroupTextProps {
21    /// The text shown inside the group.
22    #[get(type(copy))]
23    pub text: &'static str,
24}
25
26/// Props for the `euv_button_group_separator` component.
27#[derive(Clone, CustomDebug, Data, Default, New)]
28pub struct EuvButtonGroupSeparatorProps {
29    /// The direction the separator runs in.
30    #[get(type(copy))]
31    pub orientation: EuvButtonGroupSeparatorOrientation,
32}
33
34/// Props for the `euv_button_group_button` component.
35///
36/// A button inside a group carries the same settings a plain button
37/// carries: the variant, the size and the label.
38#[derive(Clone, CustomDebug, Default)]
39pub struct EuvButtonGroupButtonProps {
40    /// The visual variant determining colour scheme.
41    pub variant: EuvButtonVariant,
42    /// The size of the control.
43    pub size: EuvButtonSize,
44    /// The button label text, used as fallback when no children are provided.
45    pub label: &'static str,
46    /// Optional click event handler.
47    #[debug(skip)]
48    pub onclick: Option<Rc<dyn Fn(Event)>>,
49    /// Whether the button is disabled.
50    pub disabled: Signal<bool>,
51}