createForm API
API reference for the createForm composable.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| createForm | Forms |
| Form | Forms |
| createInput | Forms |
| createValidation | Forms |
| useRules | Plugins |
| createRegistry | Registration |
Functions
createForm
(options?: FormOptions) => FormContext<FormTicketInput, FormTicket<FormTicketInput>>Creates a new form instance. A form is a pure registry of validation contexts. Validations register themselves via `useForm()` injection. The form coordinates submit, reset, and aggregate state across all registered validations.
createFormContext
(_options?: FormContextOptions) => ContextTrinity<FormContext<FormTicketInput, FormTicket<FormTicketInput>>>Creates a new form context using the Trinity pattern.
Options
Properties
disabled
MaybeRefOrGetter<boolean>Whether the form is disabled. Components can read this to conditionally disable inputs.
readonly
MaybeRefOrGetter<boolean>Whether the form is readonly. Components can read this to conditionally disable inputs.
isValid
ComputedRef<boolean | null>Aggregate: true if all validations valid, false if any invalid, null if any unvalidated.
Methods
move
(id: ID, toIndex: number) => E | undefinedSeek for a ticket based on direction and optional predicate
seek
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => E | undefinedon
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<E, K>) => voidListen for registry events
off
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<E, K>) => voidStop listening for registry events
emit
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<E, K>) => voidEmit an event with data
batch
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete