Field

Field wraps a single form control with a label, required indicator, and validation message area.

Child controls like Input and Select inherit id and name through context, while validation rules live on the control — not on Field — so Leptos signals drive error state reactively. Compose Field inside Leptos ActionForm or router Form roots; Orbital does not ship a separate Form component.

Leptos form architecture (no Orbital Form wrapper)

Pick a Leptos form root, then compose Orbital inside it:

| Root | When | |---|---| | leptos_router::components::Form | GET navigation — filters/search in URL (?q=) | | leptos::form::ActionForm | Server action POST with progressive enhancement | | <form on:submit> + Action::dispatch | SPA controlled submit from Store |

Typical stack: form rootFieldContextProviderFieldInput / SelectButton. Form values live in a Leptos Store (store.field()) or standalone RwSignals. Native Orbital inputs use FormBind (RwSignal | store field | plain initial value for previews).

  • Any labeled control: Input, Select, checkbox groups
  • Forms where validation errors should appear below the control
  • Horizontal label layouts in compact settings rows
  • Wrap each control in <Field label="…"> (set name when posting native forms).
  • Place the control as the child — e.g. Input or Select.
  • Add rules on the child control (InputRule, SelectRule, …) to drive validation messages — for example Input bind=InputBind { value: signal.into(), rules: vec![InputRule::required(required)], ..Default::default() }.
  • Set required=true when the label should show a required indicator.
  • For multi-control forms, use FieldContextProvider at the form root.
Labeled input

Vertical layout (default): the label stacks above the control and validation messages appear below the input.

Required field

When required=true, the label shows a required indicator. Add matching InputRule::required on the child so empty values produce validation text below the control.

Horizontal layout

orientation=Horizontal places the label beside the control. Validation and hint text still render below the input; label width is fixed (~33%) so stacked horizontal fields align.

Select with validation

Field can wrap any control — here a Select with SelectRule::required. The field shows the label, required marker, and validation message from the child rules.