createValidation API
API reference for the createValidation composable.
Explore these related pages for additional context and usage patterns.
(_options?: ValidationOptions) => ValidationContext<ValidationTicketInput, ValidationTicket<ValidationTicketInput>>Creates a per-input validation instance.
Built on `createGroup` — each registered rule becomes a ticket that can be
enabled/disabled via selection methods (`select`, `unselect`, `toggle`).
Only selected (active) rules run during validation.
boolean | undefinedEnable event emission for registry operations
Default: false
boolean | undefinedEnable reactive behavior for registry operations
Default: false
MaybeRefOrGetter<boolean> | undefinedDisabled state for the entire model instance
Default: false
MaybeRefOrGetter<boolean> | undefinedAuto-select tickets on registration
Default: true
MaybeRefOrGetter<boolean> | undefinedAllow multiple tickets to be selected simultaneously
Default: false
MaybeRefOrGetter<boolean | "force"> | undefinedControls mandatory selection behavior:
- `false` (default): No mandatory selection enforcement
- `true`: Prevents deselecting the last selected item
- `'force'`: Automatically selects the first non-disabled item on registration
RuleInput[] | undefinedInitial rules to register.
unknownValue source for validate() when called without arguments.
ReadonlyMap<ID, E>The collection of tickets in the registry
numberThe number of tickets in the registry
Reactive<Set<ID>>Set of currently selected ticket IDs
ComputedRef<Set<E>>Computed Set of selected ticket instances
ComputedRef<Set<E["value"] extends Ref<infer U, infer U> ? U : E["value"]>>Computed Set of selected ticket values
MaybeRefOrGetter<boolean>Disabled state for the entire model instance
MaybeRefOrGetter<boolean>Whether the selection allows multiple selections
Reactive<Set<ID>>Set of mixed/indeterminate ticket IDs
ComputedRef<Set<E>>Set of mixed/indeterminate ticket instances
ComputedRef<boolean>Whether no items are currently selected
ComputedRef<boolean>Whether all selectable (non-disabled) items are selected
ComputedRef<boolean>Whether some but not all selectable items are selected
ShallowRef<string[]>Current validation error messages.
ShallowRef<boolean | null>Tri-state: null (not validated), true (valid), false (invalid).
ShallowRef<boolean>Whether async validation is in progress.
() => voidClear the entire registry
(id: ID) => booleanCheck if a ticket exists by ID
() => readonly ID[]Get all registered IDs
(value: E["value"]) => ID[] | undefinedBrowse for an ID(s) by value
(index: number) => ID | undefinedlookup a ticket by index number
(id: ID) => E | undefinedGet a ticket by ID
(id: ID, ticket?: Partial<Z>, event?: string) => EUpdate or insert a ticket by ID
() => readonly E[]Get all values of registered tickets
() => readonly [ID, E][]Get all entries of registered tickets
(id: ID) => voidUnregister a ticket by ID
() => voidReset the index directory and update all tickets
(id: ID, toIndex: number) => E | undefinedSeek for a ticket based on direction and optional predicate
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => E | undefined<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<E, K>) => voidListen for registry events
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<E, K>) => voidStop listening for registry events
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<E, K>) => voidEmit an event with data
() => voidClears the registry and removes all listeners
(ids: ID[]) => voidOffboard multiple tickets at once
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
(id: ID) => booleanCheck if a ticket is currently selected
(values: unknown[], options?: { multiple?) => voidApply external values to the model
() => voidMandate selected ID based on "mandatory" option
(ids: ID | ID[]) => voidSelect one or more Tickets by ID
(ids: ID | ID[]) => voidUnselect one or more Tickets by ID
(ids: ID | ID[]) => voidToggle one or more Tickets ON and OFF by ID
(ids: ID | ID[]) => voidSet one or more Tickets to mixed/indeterminate state by ID
(ids: ID | ID[]) => voidClear mixed/indeterminate state from one or more Tickets by ID
(id: ID) => booleanCheck if a ticket is in mixed/indeterminate state by ID
() => voidSelect all selectable (non-disabled) items
() => voidUnselect all items (respects mandatory option)
() => voidToggle between all selected and none selected
(rule: RuleInput | Partial<Z>) => E(rules: (RuleInput | Partial<Z>)[]) => E[](value?: unknown, silent?: boolean) => Promise<boolean>Run validation against all active (selected) rules.
() => voidReset errors and validation state. Does not affect rule selection.