-
Notifications
You must be signed in to change notification settings - Fork 9
Component FormField
MeowLynxSea edited this page Jun 18, 2026
·
1 revision
A labelled wrapper around one input. Pairs with Form but can be used standalone.
use yororen_ui::headless::form_field::form_field;
use yororen_ui::headless::text_input::text_input;
form_field("settings-email", "email", &mut *cx)
.label("Email")
.required(true)
.help("Used for sign-in.")
.error(self.email_error.as_deref())
.input(
text_input("settings-email-input")
.placeholder("you@example.com")
.on_change({
let entity = cx.entity();
move |new: &str, _, cx| entity.update(cx, |s, _| s.email = new.to_string());
})
.render(cx, window)
)
.render(cx)| Method | Purpose |
|---|---|
label(text) |
Field label. |
required(v) |
Mark the field as required. |
help(text) |
Helper line below the input. |
error(text) |
Error message below the input. |
input(el) |
The input element (typically a rendered text input / select). |
Factory takes (id, name, _cx). The name is the field's key — Form::value("email", …) and Form::error("email", …) match by this string. .render(cx) returns Stateful<Div>.
Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.