Label
Renders an accessible label associated with controls.
use leptos::prelude::*; use singlestage::{Checkbox, Input, Label}; #[component] pub fn LabelExample() -> impl IntoView { view! { <div class="space-y-4"> <div class="grid gap-2"> <Label label_for="email">"Email"</Label> <Input id="email" input_type="email" /> </div> <Label class="grid gap-2">"Password" <Input input_type="password" /></Label> <Label> <Checkbox /> "Accept terms and conditions" </Label> </div> } }
Anatomy
Import all parts and piece them together.
use leptos::prelude::*; use singlestage::Label; #[component] pub fn LabelAnatomy() -> impl IntoView { view! { <Label /> } }
API Reference
Label
Renders an accessible label associated with controls.
Name | Type | Default | Description |
---|---|---|---|
label_for | String | "" | Renamed <label> `for` attribute to avoid name collisions. |
Implements global attributes.