kozan_core/html/html_label_element.rs
1//! `HTMLLabelElement` — a label for a form control.
2//!
3//! Chrome equivalent: `HTMLLabelElement`.
4//! Associates with a form control via the `for` attribute.
5
6use crate::Handle;
7use kozan_macros::{Element, Props};
8
9/// A label element (`<label>`).
10///
11/// Chrome equivalent: `HTMLLabelElement`.
12/// Clicking a label activates its associated control.
13#[derive(Copy, Clone, Element)]
14#[element(tag = "label", data = LabelData)]
15pub struct HtmlLabelElement(Handle);
16
17/// Element-specific data for `<label>`.
18#[derive(Default, Clone, Props)]
19#[props(element = HtmlLabelElement)]
20pub struct LabelData {
21 /// The ID of the labeled control (`for` attribute).
22 /// Named `html_for` because `for` is a Rust keyword.
23 #[prop]
24 pub html_for: String,
25}