Expand description
A form-library-agnostic field convention for Dioxus.
Use this crate to connect form-library-owned values and metadata to field-shaped widgets without
coupling the widget library to a form implementation. Binding is the upper-level reactive
contract. Widget registries that do not depend on this crate can instead accept separate value,
on_change, and on_commit props matching the lower-level BindingPropTrio contract.
§Quick start
use dioxus::prelude::*;
use dioxus_field::Field;
fn app() -> Element {
let mut name = use_signal(String::new);
rsx! {
Field { context: name,
input {
value: name,
oninput: move |event| name.set(event.value()),
}
}
}
}Modules§
- testing
- Reusable assertions for widget registry conformance tests.
Structs§
- Binding
- A reactive, two-way binding to one field-shaped value.
- Binding
Prop Trio - A carrier for the lower-level prop contract implemented by field-shaped widgets.
- Field
Context - Type-erased context for one field’s binding, metadata, and focus request slot.
- Field
Description Props - Props for the headless
FieldDescriptionpart. - Field
Error Props - Props for the headless
FieldErrorpart. - Field
Meta - Signal-backed presentation metadata for one field-shaped value.
- Field
Meta IdRegistration - A lifecycle-bound description or error id registration.
- Field
Meta Overrides - Per-use overrides applied while deriving field attributes or rendering a field part.
- Field
Meta Values - Initial presentation metadata for one field-shaped value.
- Field
Props - Props for the headless
Fieldcontext provider. - Focus
Registration - A lifecycle-bound focus callback registration.
- Focus
Request - A field-scoped slot through which a widget exposes its focus behavior.
- Label
Props - Props for the headless
Labelpart.
Enums§
- Change
Origin - Describes whether a value write came from user interaction or application code.
Functions§
- Field
- Provides one
FieldContextand renders an unstyleddivaround its children. - Field
Description - Renders an unstyled description and registers its id for
aria-describedbychaining. - Field
Error - Renders pre-formatted field errors in an unstyled polite live region while invalid.
- Label
- Renders an unstyled
labelassociated with the resolved metadata’s control id. - provide_
field_ context - Provides a binding as the current scope’s
FieldContext. - use_
binding - Resolves a binding using explicit prop,
FieldContext, then uncontrolled-state precedence. - use_
field_ meta - Resolves metadata using explicit prop,
FieldContext, then standalone-state precedence. - use_
field_ meta_ state - Creates signal-backed field metadata owned by the current component scope.
- use_
focus_ registration - Registers a widget focus callback with the resolved
FocusRequestfor this component’s lifetime. - use_
focus_ request - Resolves the current
FocusRequest, or creates a standalone slot when no context exists.