1use yew::virtual_dom as vdom;
2
3pub struct Text {
5 text: vdom::VText,
6}
7
8impl Text {
9 pub(crate) fn new(text: impl Into<vdom::AttrValue>) -> Self {
10 Self {
11 text: vdom::VText::new(text),
12 }
13 }
14
15 #[must_use]
16 pub fn to_vnode(self) -> vdom::VNode {
17 vdom::VNode::VText(self.text)
18 }
19}
20
21impl From<Text> for vdom::VNode {
22 fn from(text: Text) -> Self {
23 text.to_vnode()
24 }
25}
26
27impl From<Text> for yew::Children {
28 fn from(text: Text) -> Self {
29 yew::Children::new([text.into()].to_vec())
30 }
31}