GhostForm reference
Package: @ghostvue/vue. Status: experimental (stability policy).
Headless Standard Schema v1 form container backed by useGhostForm. Manages progressive field and form error visibility, async validation epochs, submit locking, focus-on-invalid recovery, and native form reset coordination.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
focusInvalidOnSubmit | boolean | true | No | Moves focus after DOM flush to the first focusable invalid control when submit fails. |
initialIssues | readonly StandardSchemaV1.Issue[] | — | No | Optional seed issues partitioned synchronously at setup without calling `validate()`. |
novalidate | boolean | true | No | Sets HTML `novalidate` on `<form>` so Standard Schema v1 owns submit validation. |
revalidateOn | GhostFormValidateTrigger | "change" | No | Trigger that re-validates a field once it has visible issues or after submit. |
schema | TSchema | — | Yes | Standard Schema v1 validator (`schema['~standard'].version === 1`). |
schemaOptions | StandardSchemaV1.Options | — | No | Optional vendor options forwarded as the second argument to `validate()`. |
validateOn | GhostFormValidateTrigger | "submit" | No | Trigger that first reveals issues on an untouched field before the first submit. |
values | NoInfer<TValues> | — | Yes | Consumer-owned input state passed to `schema['~standard'].validate`. |
Emits
| Name | Payload | Description |
|---|---|---|
invalid | GhostFormInvalidPayload<TValues> | Emitted when a submit attempt fails schema validation on an active epoch. |
reset | Event | null | Emitted after imperative reset() or a non-cancelled native form reset completes. |
submit | GhostFormSubmitPayload<StandardSchemaV1.InferOutput<TSchema>, TValues> | Emitted with transformed schema output and waitUntil/setFieldErrors helpers when submit validation succeeds. |
Models
None declared.
Slots
| Name | Description |
|---|---|
default | Form controls, GhostField instances, and action buttons receiving GhostFormSlotProps. |
Slot props: default
None declared.
Exposed members
| Name | Type | Description |
|---|---|---|
clearErrors | (path?: import('./ghost-form').GhostFormFieldPath<TValues> | undefined) => void | Exposed method `clearErrors`. |
element | HTMLFormElement | null | Exposed property `element`. |
reset | () => void | Exposed method `reset`. |
setFieldErrors | (path: (string & {}) | import('./ghost-form').GhostFormFieldPath<TValues>, messages: readonly string[]) => void | Exposed method `setFieldErrors`. |
setFormErrors | (messages: readonly string[]) => void | Exposed method `setFormErrors`. |
submit | (event?: SubmitEvent | null) => Promise<import('./ghost-form').GhostFormSubmitResult<StandardSchemaV1.InferOutput<TSchema>>> | Exposed method `submit`. |
validate | () => Promise<import('./ghost-form').GhostFormValidateResult<StandardSchemaV1.InferOutput<TSchema>>> | Exposed method `validate`. |
validateField | (path: import('./ghost-form').GhostFormFieldPath<TValues>) => Promise<readonly StandardSchemaV1.Issue[]> | Exposed method `validateField`. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | root | Native <form> element carrying class ghost-form and novalidate. |
data-state | submitting | Active during submit validation and any awaited onSubmit or waitUntil promises. |
data-state | validating | Active while an asynchronous background or validate() check is pending and not submitting. |
data-state | invalid | Active when visible field or form errors exist and neither pending flag is active. |
CSS variables
None declared.
Accessibility
Role: form. APG pattern: https://www.w3.org/WAI/ARIA/apg/.
Required ARIA attributes: aria-busy, aria-invalid, aria-describedby.
Keyboard
| Key | Action | Automated browser test |
|---|---|---|
Enter | Submits the form from native text inputs or focused submit buttons without triggering a page reload; composite popups such as GhostSelect isolate Enter to option selection. | GhostForm › validates on keyboard Enter, moves focus to first invalid field, isolates popup Enter, repairs, and passes axe (@ghostvue/vue) |
Tab | Moves focus sequentially between form controls and actions; focusout triggers blur validation when validateOn or revalidateOn is 'blur'. | GhostForm › validates on keyboard Enter, moves focus to first invalid field, isolates popup Enter, repairs, and passes axe (@ghostvue/vue) |
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Passed | Every declared key maps to a Chromium browser test that CI runs and requires to pass on every commit. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
form/profile-schema
Typed Standard Schema v1 form with input transformation, nested paths, form-level alert, and standalone field opt-out.
form/async-validation
Pending submit state via waitUntil, out-of-order validation safety, and imperative setFieldErrors.
form/nested-webhooks
Dynamic nested array paths with blur validation and GhostField scoped error display.
form/composable
Lower-level useGhostForm binding formProps onto a native form element.