Skip to content

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.

All component references

Props ​

NameTypeDefaultRequiredDescription
focusInvalidOnSubmitbooleantrueNoMoves focus after DOM flush to the first focusable invalid control when submit fails.
initialIssuesreadonly StandardSchemaV1.Issue[]—NoOptional seed issues partitioned synchronously at setup without calling `validate()`.
novalidatebooleantrueNoSets HTML `novalidate` on `<form>` so Standard Schema v1 owns submit validation.
revalidateOnGhostFormValidateTrigger"change"NoTrigger that re-validates a field once it has visible issues or after submit.
schemaTSchema—YesStandard Schema v1 validator (`schema['~standard'].version === 1`).
schemaOptionsStandardSchemaV1.Options—NoOptional vendor options forwarded as the second argument to `validate()`.
validateOnGhostFormValidateTrigger"submit"NoTrigger that first reveals issues on an untouched field before the first submit.
valuesNoInfer<TValues>—YesConsumer-owned input state passed to `schema['~standard'].validate`.

Emits ​

NamePayloadDescription
invalidGhostFormInvalidPayload<TValues>Emitted when a submit attempt fails schema validation on an active epoch.
resetEvent | nullEmitted after imperative reset() or a non-cancelled native form reset completes.
submitGhostFormSubmitPayload<StandardSchemaV1.InferOutput<TSchema>, TValues>Emitted with transformed schema output and waitUntil/setFieldErrors helpers when submit validation succeeds.

Models ​

None declared.

Slots ​

NameDescription
defaultForm controls, GhostField instances, and action buttons receiving GhostFormSlotProps.

Slot props: default ​

None declared.

Exposed members ​

NameTypeDescription
clearErrors(path?: import('./ghost-form').GhostFormFieldPath<TValues> | undefined) => voidExposed method `clearErrors`.
elementHTMLFormElement | nullExposed property `element`.
reset() => voidExposed method `reset`.
setFieldErrors(path: (string & {}) | import('./ghost-form').GhostFormFieldPath<TValues>, messages: readonly string[]) => voidExposed method `setFieldErrors`.
setFormErrors(messages: readonly string[]) => voidExposed 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 ​

AttributeValueDescription
data-partrootNative <form> element carrying class ghost-form and novalidate.
data-statesubmittingActive during submit validation and any awaited onSubmit or waitUntil promises.
data-statevalidatingActive while an asynchronous background or validate() check is pending and not submitting.
data-stateinvalidActive 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 ​

KeyActionAutomated browser test
EnterSubmits 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)
TabMoves 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.

CategoryStatusEvidence
Automated keyboardPassedEvery declared key maps to a Chromium browser test that CI runs and requires to pass on every commit.
Manual interactionNot reviewedNo review recorded.
Assistive technologyNot reviewedNo review recorded.

Examples ​

form/profile-schema ​

Example source

Workspace profile schema

Typed Standard Schema v1 form with input transformation, nested paths, form-level alert, and standalone field opt-out.

Workspace profile

Validates with Standard Schema v1 and transforms strings to typed numbers and URLs on submit.

form/async-validation ​

Example source

Async validation and server errors

Pending submit state via waitUntil, out-of-order validation safety, and imperative setFieldErrors.

Claim workspace URL

form/nested-webhooks ​

Example source

Nested webhook array

Dynamic nested array paths with blur validation and GhostField scoped error display.

Event webhooks

form/composable ​

Example source

Headless composable Headless

Lower-level useGhostForm binding formProps onto a native form element.