singlestage/components/badge/
mod.rs1use leptos::prelude::*;
2
3#[component]
4pub fn Badge(
5 children: Children,
6
7 #[prop(optional, into)]
12 accesskey: MaybeProp<String>,
13 #[prop(optional, into)]
18 autocapitalize: MaybeProp<String>,
19 #[prop(optional, into)]
22 autofocus: MaybeProp<bool>,
23 #[prop(optional, into)]
25 class: MaybeProp<String>,
26 #[prop(optional, into)]
30 contenteditable: MaybeProp<String>,
31 #[prop(optional, into)]
35 dir: MaybeProp<String>,
36 #[prop(optional, into)]
38 draggable: MaybeProp<bool>,
39 #[prop(optional, into)]
41 enterkeyhint: MaybeProp<String>,
42 #[prop(optional, into)]
44 exportparts: MaybeProp<String>,
45 #[prop(optional, into)]
47 hidden: MaybeProp<String>,
48 #[prop(optional, into)]
50 id: MaybeProp<String>,
51 #[prop(optional, into)]
53 inert: MaybeProp<bool>,
54 #[prop(optional, into)]
57 inputmode: MaybeProp<String>,
58 #[prop(optional, into)]
60 is: MaybeProp<String>,
61 #[prop(optional, into)]
63 itemid: MaybeProp<String>,
64 #[prop(optional, into)]
66 itemprop: MaybeProp<String>,
67 #[prop(optional, into)]
69 itemref: MaybeProp<String>,
70 #[prop(optional, into)]
72 itemscope: MaybeProp<String>,
73 #[prop(optional, into)]
75 itemtype: MaybeProp<String>,
76 #[prop(optional, into)]
78 lang: MaybeProp<String>,
79 #[prop(optional, into)]
81 nonce: MaybeProp<String>,
82 #[prop(optional, into)]
84 part: MaybeProp<String>,
85 #[prop(optional, into)]
87 popover: MaybeProp<String>,
88 #[prop(optional, into)]
90 role: MaybeProp<String>,
91 #[prop(optional, into)]
93 slot: MaybeProp<String>,
94 #[prop(optional, into)]
98 spellcheck: MaybeProp<String>,
99 #[prop(optional, into)]
101 style: MaybeProp<String>,
102 #[prop(optional, into)]
104 tabindex: MaybeProp<usize>,
105 #[prop(optional, into)]
107 title: MaybeProp<String>,
108 #[prop(optional, into)]
110 translate: MaybeProp<String>,
111
112 #[prop(optional, into)]
115 variant: MaybeProp<String>,
116) -> impl IntoView {
117 let global_attrs_1 = view! {
118 <{..}
119 accesskey=move || accesskey.get()
120 autocapitalize=move || autocapitalize.get()
121 autofocus=move || autofocus.get()
122 contenteditable=move || contenteditable.get()
124 dir=move || dir.get()
125 draggable=move || draggable.get()
126 enterkeyhint=move || enterkeyhint.get()
127 exportparts=move || exportparts.get()
128 hidden=move || hidden.get()
129 id=move || id.get()
130 inert=move || inert.get()
131 inputmode=move || inputmode.get()
132 is=move || is.get()
133 itemid=move || itemid.get()
134 />
135 };
136
137 let global_attrs_2 = view! {
138 <{..}
139 itemprop=move || itemprop.get()
140 itemref=move || itemref.get()
141 itemscope=move || itemscope.get()
142 itemtype=move || itemtype.get()
143 lang=move || lang.get()
144 nonce=move || nonce.get()
145 part=move || part.get()
146 popover=move || popover.get()
147 role=move || role.get()
148 slot=move || slot.get()
149 spellcheck=move || spellcheck.get()
150 style=move || style.get()
151 tabindex=move || tabindex.get()
152 title=move || title.get()
153 translate=move || translate.get()
154 />
155 };
156
157 view! {
158 <span
159 class=move || {
160 format!(
161 "{} {}",
162 match variant.get().unwrap_or_default().as_str() {
163 "primary" => "singlestage-badge-primary",
164 "secondary" => "singlestage-badge-secondary",
165 "destructive" => "singlestage-badge-destructive",
166 "outline" => "singlestage-badge-outline",
167 _ => "singlestage-badge-primary",
168 },
169 class.get().unwrap_or_default(),
170 )
171 }
172
173 {..global_attrs_1}
174 {..global_attrs_2}
175 >
176 {children()}
177 </span>
178 }
179}