Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Blocks
  2. Forms
  3. API and Development

Forms

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
@prepared911/ui does not ship react-hook-form, Zod schemas, or Form* controller wrappers. Form is the form element. Field is a labeled control. Layout blocks compose Save and Cancel.
Import
Form
Import Form from @prepared911/ui/form. It renders a form element. It does not provide a form context.
PropBehavior
onSubmitRuns after native validation. The caller validates and sets invalid or errorSummary. If it returns a promise and pending is not controlled, the form stays pending until the promise settles.
pendingSets aria-busy and ignores further submits. useFormPending() is how a Save button reads that state.
errorSummaryLocalized copy in an alert before the fields.
errorFocusAfter a failed attempt, focus moves to the first invalid control (FirstInvalid, the default), the summary, or nowhere (None).
noValidateDefaults to true so the browser does not race the caller's validation.
onAfterResetRuns after a native reset. The form does not clear caller state.
Save stays enabled when values are unchanged. The form does not track dirty state.
Field
Import Field from @prepared911/ui/field. It composes a label, the control, description, and error. Input is the bare control and has no label or icons.
PropBehavior
labelVisible name of the control.
typeFieldType, including Password and Tel.
leadingIcon, trailingIconDecorative icons.
actionOne button at the end. Search and Password own their own trailing control, so they do not take action.
maskInput mask. It is not a separate enum to pass to Input.
onValueChangeThe next value and a details object. This replaces onChange(event) on the old input.
An international country select is not part of Field. North American phone numbers use FieldType.Tel.
Select
Import Select from @prepared911/ui/select. Options replace an items list. An empty value is null. Put Select inside the app's controller when the form library owns the value.
Layout blocks
BlockImportRole
FormLayoutStandard@prepared911/ui/blocks/form-layout-standardFields plus a Save/Cancel footer. submitLabel is required. submitIntent defaults to accent.
FormLayoutSectioned@prepared911/ui/blocks/form-layout-sectionedThe same submit contract across sections.
FormLayoutDrawer@prepared911/ui/blocks/form-layout-drawerA drawer with a scrolling body and a sticky footer. Closing a dirty form asks for confirmation.
FormDialog@prepared911/ui/blocks/form-dialogA dialog with the same submit and dirty-guard behavior.
These blocks pass onSubmit, errorSummary, invalid, errorFocus, pending, and noValidate through to Form. Copy props are localized messages with no default English strings. FormLayoutStandard does not disable Save because the form is pristine. submitDisabled is an explicit prop, default false.
App-owned validation
Keep Zod and react-hook-form in the feature. Render Form or a layout block and pass onSubmit={form.handleSubmit(fn)} from the app. @prepared911/ui does not export useZodForm, emailSchema, or FormInput.
Previous
Forms / Usage
Next
Forms / Accessibility
On this page
Import
Form
Field
Select
Layout blocks
App-owned validation