patternfly_yew/components/card/
title.rs

1use yew::prelude::*;
2
3#[derive(Debug, Clone, PartialEq, Properties)]
4pub struct CardTitleProperties {
5    /// Content rendered inside the Card Title.
6    #[prop_or_default]
7    pub children: Html,
8    /// Additional classes added to the Card Title.
9    #[prop_or_default]
10    pub class: Classes,
11    /// Sets the base component to render. Defaults to "div".
12    #[prop_or(String::from("div"))]
13    pub component: String,
14}
15
16#[function_component(CardTitle)]
17pub fn card_title(props: &CardTitleProperties) -> Html {
18    let class = classes!(props.class.clone(), "pf-v5-c-card__title-text");
19    html! {
20        <div class={"pf-v5-c-card__title"}>
21            <@{props.component.clone()} {class}>
22                {props.children.clone()}
23            </@>
24        </div>
25    }
26}