Skip to main content

euv_ui/component/tabs/view/
struct.rs

1use super::*;
2
3/// One entry of the [`euv_tabs`] tab bar.
4///
5/// The `key` is the stable identity used for diffing and is written into
6/// the caller-owned `active` signal; the `label` is the visible text.
7#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
8pub struct EuvTabItem {
9    /// The stable identity of this tab (written to the `active` signal).
10    #[get(type(copy))]
11    pub key: &'static str,
12    /// The display label of this tab.
13    #[get(type(copy))]
14    pub label: &'static str,
15}
16
17/// Props for the [`euv_tabs`] component.
18///
19/// The selected tab lives in the caller-owned `active` signal so it survives
20/// re-renders and can be shared with page-level state; the panel content is
21/// supplied as children and is always mounted.
22#[derive(Clone, CustomDebug, Default)]
23pub struct EuvTabsProps {
24    /// The tab entries rendered in the bar, in display order.
25    pub items: Vec<EuvTabItem>,
26    /// The key of the selected tab (drives the `_active` tab class).
27    pub active: Signal<String>,
28}