Sigil

Validated field

A label above a control.

.required marks the control required for screen readers and shows a marker after the label while it is true. .error shows the message under the control and paints the control invalid while it is Some. The control is marked invalid while an error shows and is described by the message.

GUITUIRuns in the browserfield

Preview

Validated field, Default, light themeValidated field, Default, dark theme

Usage example

fn validated_field_demo(error: Option<String>) -> FieldBuilder<TextFieldBuilder> {    field(        "Email",        text_field(signal(String::from("ada@"))).placeholder("name@example.com"),    )    .error(signal(error))}
fn validated_field_demo(  error: Option<String>,) -> FieldBuilder<TextFieldBuilder> {  field(    "Email",    text_field(signal(String::from(      "ada@",    )))    .placeholder("name@example.com"),  )  .error(signal(error))}

States

All 3 captured states, each drawn by the window host and by the terminal host.

  • Validated field, Default, light themeValidated field, Default, dark theme
    Default
  • Validated field, Focused, light themeValidated field, Focused, dark theme
    Focused
  • Validated field, Invalid, light themeValidated field, Invalid, dark theme
    Invalid

API

NameSignaturePurpose
field`fn field<C: IntoNode>(label, control: C) -> FieldBuilder<C>`; `.error(impl Reactive<Option<String>>)` when `C: FieldControl`; `.required(impl Reactive<bool>)`A label above a control. .required marks the control required for screen readers and shows a marker after the label while it is true. .error shows the message under the control and paints the control invalid while it is Some. The control is marked invalid while an error shows and is described by the message.