Skip to main content

yew_bulma/forms/
label.rs

1use yew::prelude::*;
2
3pub struct Label {
4    props: Props,
5}
6
7#[derive(Clone, Properties)]
8pub struct Props {
9    pub text: String,
10}
11
12impl Component for Label {
13    type Message = ();
14    type Properties = Props;
15
16    fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self {
17        Self { props }
18    }
19
20    fn change(&mut self, props: Self::Properties) -> bool {
21        self.props = props;
22        true
23    }
24
25    fn update(&mut self, _: Self::Message) -> ShouldRender {
26        false
27    }
28
29    fn view(&self) -> Html {
30        html! {
31            <label class="label">{ &self.props.text }</label>
32        }
33    }
34}