RavenRS · Rust GUI

TextField

Edit and run the TextField RavenRS example in your browser. Explore its Rust code and download a Cargo project for desktop and WebAssembly.

One declarative Rust interface, GPU rendering, reactive state and semantic design tokens. Free and open source under MIT OR Apache-2.0.

Rust source

fn text_field() -> impl View {
    let name = State::new(String::new());
    let price = State::new(String::from("49,90"));
    let shown = name.clone();
    VStack::new((
        TextField::new(name.binding()).placeholder("Full name").icon(IconName::User).clearable(),
        TextField::new(price.binding())
            .placeholder("Price")
            .size(ButtonSize::Small)
            .prefix(Text::new("R$").foreground(Semantic::InkMuted))
            .suffix(Badge::new("per month")),
        Text::dynamic(move || format!("Hello, {}", shown.get())).foreground(Semantic::InkMuted),
    ))
    .spacing(12.0)
    .align(Align::Stretch)
}

The interactive preview loads when JavaScript and WebGPU or WebGL2 are available. You can read the guide and examples here at any time.

More examples