adam_web_ui/components/label/component.rs
1//! Styled upstream label implementation; see `../UPSTREAM.md`.
2use dioxus::prelude::*;
3use dioxus_primitives::label::{self, LabelProps};
4include!(concat!(env!("OUT_DIR"), "/label-styles.rs"));
5
6/// Renders the official label associated with the caller's control identifier.
7///
8/// - Complexity: O(attributes + children) render work.
9///
10/// # Examples
11/// ```
12/// use adam_web_ui::components::label::Label;
13/// use dioxus::prelude::*;
14/// fn app() -> Element { rsx! { Label { html_for: "name", "Name" } } }
15/// ```
16#[component]
17pub fn Label(props: LabelProps) -> Element {
18 crate::components::styles::use_control_styles();
19 rsx! {
20 label::Label {
21 class: Styles::dx_label,
22 html_for: props.html_for,
23 attributes: props.attributes,
24 {props.children}
25 }
26 }
27}