Skip to main content

euv_ui/component/radio/view/
struct.rs

1use super::*;
2
3/// One selectable entry of the [`euv_radio_group`].
4///
5/// Carries the machine value submitted with the form and the label the
6/// user reads; the group compares the machine value against its own
7/// `value` signal to decide which item renders as checked.
8#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
9pub struct EuvRadioOption {
10    /// The machine value submitted when this option is selected.
11    #[get(type(copy))]
12    pub value: &'static str,
13    /// The display label shown next to the radio control.
14    #[get(type(copy))]
15    pub label: &'static str,
16}
17
18/// Props for the `euv_radio` component.
19///
20/// Defines the strongly-typed interface for a radio group. The selection
21/// is owned by the caller through a `Signal<String>` so the group can
22/// take part in two-way binding with the rest of the page.
23#[derive(Clone, CustomDebug, Data, Default, New)]
24pub struct EuvRadioGroupProps {
25    /// The HTML name attribute shared by every radio in the group.
26    #[get(type(copy))]
27    pub name: &'static str,
28    /// The selectable options rendered in declaration order.
29    pub options: Vec<EuvRadioOption>,
30    /// The signal holding the currently selected option value.
31    #[get(type(copy))]
32    pub value: Signal<String>,
33    /// The group label text displayed above the options.
34    #[get(type(copy))]
35    pub label: &'static str,
36}