Skip to main content

Crate dioxus_field

Crate dioxus_field 

Source
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.
BindingPropTrio
A carrier for the lower-level prop contract implemented by field-shaped widgets.
FieldContext
Type-erased context for one field’s binding, metadata, and focus request slot.
FieldDescriptionProps
Props for the headless FieldDescription part.
FieldErrorProps
Props for the headless FieldError part.
FieldMeta
Signal-backed presentation metadata for one field-shaped value.
FieldMetaIdRegistration
A lifecycle-bound description or error id registration.
FieldMetaOverrides
Per-use overrides applied while deriving field attributes or rendering a field part.
FieldMetaValues
Initial presentation metadata for one field-shaped value.
FieldProps
Props for the headless Field context provider.
FocusRegistration
A lifecycle-bound focus callback registration.
FocusRequest
A field-scoped slot through which a widget exposes its focus behavior.
LabelProps
Props for the headless Label part.

Enums§

ChangeOrigin
Describes whether a value write came from user interaction or application code.

Functions§

Field
Provides one FieldContext and renders an unstyled div around its children.
FieldDescription
Renders an unstyled description and registers its id for aria-describedby chaining.
FieldError
Renders pre-formatted field errors in an unstyled polite live region while invalid.
Label
Renders an unstyled label associated 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 FocusRequest for this component’s lifetime.
use_focus_request
Resolves the current FocusRequest, or creates a standalone slot when no context exists.