Skip to main content

OutlinedTextField

Function OutlinedTextField 

Source
pub fn OutlinedTextField(
    modifier: Modifier,
    value: String,
    on_value_change: impl Fn(String) + 'static,
    config: OutlinedTextFieldConfig,
) -> View
Expand description

M3 Outlined Text Field with floating label, leading/trailing icons, and error state.

The label floats up when value is non-empty or when the field is focused. Focus state comes from the persistent focus_tracker, which paint updates on the frame the field gains/loses focus (one-frame delay on tap-to-float).

§Example

let text = remember(|| signal(String::new()));
OutlinedTextField(
    Modifier::new().fill_max_width().padding(16.0),
    text.get(),
    { let t = text.clone(); move |v| t.set(v) },
    OutlinedTextFieldConfig {
        label: Some("Email".into()),
        placeholder: Some("user@example.com".into()),
        ..Default::default()
    },
);