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 scope to manage the state and actions of input fields in a form.

Link copied to clipboard
interface FormState<T>

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.

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 : 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

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

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

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.