patternfly_yew/components/tabs/
mod.rs1#[cfg(feature = "yew-nested-router")]
3mod router;
4mod simple;
5
6#[cfg(feature = "yew-nested-router")]
7pub use router::*;
8pub use simple::*;
9
10use yew::prelude::*;
11
12#[derive(Clone, Debug, PartialEq, Properties)]
14pub struct TabContentBodyProperties {
15 #[prop_or_default]
16 pub children: Html,
17
18 #[prop_or_default]
19 pub padding: bool,
20}
21
22#[function_component(TabContentBody)]
30pub fn tab_content_body(props: &TabContentBodyProperties) -> Html {
31 let mut class = classes!("pf-v6-c-tab-content__body");
32
33 if props.padding {
34 class.push(classes!("pf-m-padding"));
35 }
36
37 html!(<div {class}>{ props.children.clone() }</div>)
38}
39
40#[derive(PartialEq, Properties)]
42pub struct TabContentProperties {
43 #[prop_or_default]
44 pub id: Option<AttrValue>,
45
46 #[prop_or_default]
47 pub hidden: bool,
48
49 #[prop_or_default]
50 pub children: Html,
51
52 #[prop_or_default]
53 pub class: Classes,
54
55 #[prop_or_default]
56 pub style: Option<AttrValue>,
57}
58
59#[function_component(TabContent)]
69pub fn tab_content(props: &TabContentProperties) -> Html {
70 let mut class = Classes::from("pf-v6-c-tab-content");
71
72 class.extend(&props.class);
73
74 html!(
75 <section
76 id={props.id.clone()}
77 {class}
78 hidden={props.hidden}
79 tabindex="0"
80 role="tabpanel"
81 style={props.style.clone()}
82 >
83 { props.children.clone() }
84 </section>
85 )
86}