Package-level declarations

Types

Link copied to clipboard
class FieldControl<V>(val name: FieldName, val policy: FieldPolicy, val rule: FormRule<V>, val defaultValue: V, val getValue: () -> V, val setValue: (V) -> Unit, val getErrors: () -> FieldErrors, val setErrors: (FieldErrors) -> Unit, val shouldTrigger: (FieldValidateOn) -> Boolean, val isEnabled: () -> Boolean)

Represents a field control in a form.

Link copied to clipboard

A mutable implementation of FieldMeta that tracks field-level metadata.

Link copied to clipboard
fun interface FieldRule<T>

A functional interface for field validation rules.

Link copied to clipboard
interface Form<T> : FormData<T> , HasFormBinding<T>

A form interface that provides form state management and submission handling.

Link copied to clipboard
interface FormBinding<T>

Internal interface for form binding operations.

Link copied to clipboard
interface FormField<V>

A control interface for managing individual form field state and interactions.

Link copied to clipboard

A mutable implementation of FormMeta that tracks form-level metadata.

Link copied to clipboard
interface FormPolicy

Defines the policy configuration for form validation behavior.

Link copied to clipboard

A scope to manage the state and actions of input fields in a form.

Link copied to clipboard
class FormState<T>(value: T, val meta: FormMetaState) : FormData<T>

A mutable implementation of FormData that manages form state.

Link copied to clipboard

Interface for objects that have access to form binding operations.

Link copied to clipboard

The managed state of a form.

Link copied to clipboard
class SubmissionControl<T>(val policy: SubmissionPolicy, val rule: FormRule<T>, val submit: () -> Unit, val initialValue: T, val getValue: () -> T, val hasError: () -> Boolean, val getFieldKeys: () -> FormFieldNames, val isSubmitting: () -> Boolean, val isSubmitted: () -> Boolean, val getSubmitCount: () -> Int)

Represents a submission control in a form.

Properties

Link copied to clipboard

Whether the field currently has any validation errors.

Link copied to clipboard

A minimal form policy that performs validation only on form submission.

Functions

Link copied to clipboard
fun <V> Controller(control: FieldControl<V>, content: @Composable (Field<V>) -> Unit)

A controller for a form field control.

A controller for a form submission control.

Link copied to clipboard
fun <T, V> Form<T>.Field(selector: (T) -> V, updater: T.(V) -> T, validator: FieldValidator<V>? = null, name: FieldName? = null, dependsOn: FieldNames? = null, enabled: Boolean = true, render: @Composable (FormField<V>) -> Unit)

Creates a form field with validation and state management.

fun <T, V, S, U> Form<T>.Field(selector: (T) -> V, updater: T.(V) -> T, adapter: FieldTypeAdapter<V, S, U>, validator: FieldValidator<S>? = null, name: FieldName? = null, dependsOn: FieldNames? = null, enabled: Boolean = true, render: @Composable (FormField<U>) -> Unit)

Creates a form field with type adaptation, validation, and state management.

Link copied to clipboard
fun <T : Any> Form(onSubmit: suspend (T) -> Unit, initialValue: T, modifier: Modifier = Modifier, onError: (err: Throwable) -> Unit? = null, saver: Saver<T, Any> = autoSaver(), key: Any? = null, policy: FormPolicy = FormPolicy.Default, coroutineScope: CoroutineScope = rememberCoroutineScope(), content: @Composable FormScope<T>.() -> Unit)

A Form to manage the state and actions of input fields, and create a child block of FormScope.

Link copied to clipboard
fun FormPolicy(formOptions: FormOptions = FormOptions, fieldOptions: FieldOptions = FieldOptions): FormPolicy

Creates a FormPolicy with the specified form and field options.

Link copied to clipboard

Adds a callback to be invoked when the focus state of the field changes.

Link copied to clipboard
fun <T, V> Form<T>.rememberField(selector: (T) -> V, updater: T.(V) -> T, validator: FieldValidator<V>? = null, name: FieldName? = null, dependsOn: FieldNames? = null, enabled: Boolean = true): FormField<V>

Creates and remembers a form field control with validation and state management.

fun <T, V, S, U> Form<T>.rememberField(selector: (T) -> V, updater: T.(V) -> T, adapter: FieldTypeAdapter<V, S, U>, validator: FieldValidator<S>? = null, name: FieldName? = null, dependsOn: FieldNames? = null, enabled: Boolean = true): FormField<U>

Creates and remembers a form field control with type adaptation, validation, and state management.

Link copied to clipboard
fun <T : Any, V> FormScope<T>.rememberFieldRuleControl(name: FieldName, select: T.() -> V, update: T.(V) -> T, enabled: T.() -> Boolean = { true }, dependsOn: Set<FieldName>? = null, builder: ValidationRuleBuilder<V>.() -> Unit): FieldControl<V>
fun <T : Any, V> FormScope<T>.rememberFieldRuleControl(name: FieldName, select: T.() -> V, update: T.(V) -> T, enabled: T.() -> Boolean = { true }, dependsOn: Set<FieldName>? = null, ruleSet: ValidationRuleSet<V>): FieldControl<V>

Remembers a field control for the given field name with the given rule set.

Link copied to clipboard
fun <T> rememberForm(state: FormState<T>, onSubmit: (T) -> Unit): Form<T>

Remembers a form with the given form state and submission handler.

fun <T> rememberForm(initialValue: T, saver: Saver<T, Any> = autoSaver(), policy: FormPolicy = FormPolicy(), onSubmit: (T) -> Unit): Form<T>

Remembers a form with the given initial value and submission handler.

Link copied to clipboard

Remembers form metadata state with automatic state restoration.

Link copied to clipboard
fun <T> rememberFormState(initialValue: T, saver: Saver<T, Any> = autoSaver(), policy: FormPolicy = FormPolicy()): FormState<T>

Remembers a form state for the given initial value.

Link copied to clipboard

Remembers a submission rule control that automatically controls state of the form.

Link copied to clipboard
fun <T : Any, V> FormScope<T>.rememberWatch(select: T.() -> V): V

Remembers a watch value that automatically updates when the form state changes.

Link copied to clipboard
@ExperimentalSerializationApi
inline fun <T> serializationSaver(serializer: KSerializer<T> = serializer(), bundler: Bundler = Bundler): Saver<T, Any>

Create an Saver for Kotlin Serialization.

Link copied to clipboard
fun <T, R> Form<T>.watch(calculation: FormData<T>.() -> R): R

Watches for changes in form state and recomputes a derived value.