patternfly_yew/components/card/
body.rs

1use yew::prelude::*;
2
3#[derive(Debug, Clone, PartialEq, Properties)]
4pub struct CardBodyProperties {
5    /// Content rendered inside the Card Body.
6    #[prop_or_default]
7    pub children: Html,
8    /// Additional classes added to the Card Body.
9    #[prop_or_default]
10    pub class: Classes,
11    /// Sets the base component ot render. Defaults to "div".
12    #[prop_or(String::from("div"))]
13    pub component: String,
14    /// Enables the body Content to fill the height of the card
15    #[prop_or(true)]
16    pub filled: bool,
17}
18
19#[function_component(CardBody)]
20pub fn body(props: &CardBodyProperties) -> Html {
21    let mut class = props.class.clone();
22    class.push("pf-v5-c-card__body");
23    if !props.filled {
24        class.push("pf-m-no-fill");
25    }
26    html! {
27        <@{props.component.clone()} {class}>
28            {props.children.clone()}
29        </@>
30    }
31}