basecoat_core/props/
tabs.rs1use crate::{AttrMap, BasecoatProps};
2use std::borrow::Cow;
3
4#[derive(Clone, Debug, PartialEq, Eq, Default)]
6pub enum TabsOrientation {
7 #[default]
8 Horizontal,
9 Vertical,
10}
11
12impl std::fmt::Display for TabsOrientation {
13 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14 match self {
15 TabsOrientation::Horizontal => f.write_str("horizontal"),
16 TabsOrientation::Vertical => f.write_str("vertical"),
17 }
18 }
19}
20
21#[derive(Clone, Debug, Default)]
23pub struct TabSet {
24 pub tab: Cow<'static, str>,
26 pub panel: Option<Cow<'static, str>>,
28}
29
30#[derive(BasecoatProps, Default, Clone, Debug)]
32pub struct TabsProps {
33 #[prop(optional, into)]
35 pub id: Option<Cow<'static, str>>,
36 #[prop(default)]
38 pub tabsets: Vec<TabSet>,
39 #[prop(default = 1usize)]
41 pub default_tab_index: usize,
42 #[prop(default)]
43 pub orientation: TabsOrientation,
44 #[prop(optional, into)]
45 pub class: Option<Cow<'static, str>>,
46 #[prop(extend)]
47 pub attrs: AttrMap,
48}