Skip to main content

labeled_field

Function labeled_field 

pub fn labeled_field<C>(label: impl Into<String>, control: C) -> Column
where C: FormControl + 'static,
Expand description

Compose a visible semantic label with the control it names.

label is normally a Fluent message key. Both the Text and control resolve that same key through the live localization catalog, preventing the visible copy and accessibility name from drifting. The returned ordinary Column hugs the label and control rather than claiming the form’s full height; it remains chainable and participates in the standard retained lifecycle.

use tilo_ui::widget::{TextInput, labeled_field};

let email = labeled_field(
    "account-email-label",
    TextInput::local()
        .with_id("account-email")
        .with_placeholder("account-email-placeholder"),
);