Function dioxus_material::TextField

source ·
pub fn TextField<'a>(cx: Scope<'a, TextFieldProps<'a>>) -> Element<'a>
Expand description

Text field component.

Text fields let users enter text into a UI.

material.io

Panics

This component requires access to a Theme.

Examples

use dioxus::prelude::*;
use dioxus_material::{TextField, Theme};

fn app(cx: Scope) -> Element {
    let value = use_state(cx, || String::from("Filled"));
    render!(
        Theme {
            TextField {
                label: "Text field",
                value: "{value}",
                onchange: move |event: FormEvent| value.set(event.value.clone())
            }
        }
    )
}

Props

For details, see the props struct definition.