Form dialog
import { FormDialog, FormField, FormStep, FormError, FeedbackDialog, ReportDialog, reportNextLine } from "@arcadia/ui";Username
adaFeedback
Report
FormDialog
openrequired- boolean
onOpenChangerequired- (open: boolean) => void
onOpenChangeComplete- (open: boolean) => void
- Called after it has opened or closed, once its motion ends.
titlerequired- ReactNode
description- ReactNode
- The consequence of the action, when there is one. A FormStep's own description replaces it on that step.
size- "md" | "lg"
- Default:
"md" lg480px.submitLabelrequired- string
- The primary's label on the last step ("Change password").
tone- "neutral" | "danger"
- Default:
"neutral" onSubmitrequired- () => Promise<A> | A
- Resolves on success (the dialog closes; the caller toasts in three words or fewer). Rejects with a FormError to show its message, on a field and step when it names them; any other rejection is the form's message, or the primary's action ("Couldn't save.") when it says nothing. Its resolved value is what
sentTitleshows. instant- boolean
- It was opened from the keyboard (a row of a menu by Enter): it is there in one frame.
sentLabel- string
- Once the send resolves, this word stands in the primary's seat and the dialog closes by itself (Feedback's "Sent").
sentTitle- ReactNode
- Once the send resolves, the dialog stays open on what it answered, under this title, with Done: the receipt.
renderSent- (answer: A) => ReactNode
- How the answer reads on the receipt: one line of what happens next.
canSubmit- boolean
- Default:
true - The primary is enabled when true. Never false for a form that is not yet valid: its fields'
rules hold the submit and say what to fix (K30). initialFocus- ComponentProps<typeof DialogContent>["initialFocus"]
- Where focus goes on open: an element,
falseto stay, or a function of how it opened. Default: the form's first field. finalFocus- ComponentProps<typeof DialogContent>["finalFocus"]
- Where focus goes on close. Default: wherever it was before it opened.
name- string
- The form's name, rendered as
data-formon the dialog: what a test or a product rule finds it by. container- PortalContainer
- Where a surface's portal mounts. Default:
document.body. Pass a themed subtree to keep itsdata-theme, or a transformed stage to containposition: fixedoverlays (previews): a modal set down in one stays in it, shown in place, out of the browser's top layer. aside- ReactNode
submitProps- ButtonMarks
- The product's own marks on the primary while it submits (on a form in steps, the last step's): its
data-*only. cancelProps- ButtonMarks
- The product's own marks on Cancel: its
data-*only. childrenrequired- ReactNode
- Fields (FormField + Input), or FormStep children for a form in steps.
namerequired- string
- The
nameof the input inside: a FormError names it, and its rule is checked when it is left. rule- string | null
- The message while the value breaks a rule ("At least 12 characters"), else null. Shown once the field is left holding something, and on a submit, which waits until every rule of its step is met; never on an empty field before a submit, and never while the first characters are typed.
label- ReactNode
hint- string
- Why or how, for a field its label cannot explain: a
Hintafter the label, and the control's description. At most 160 characters. description- ReactNode
- Help text under the label (text-3, Caption).
action- ReactNode
- One control at the end of the error line, for an override its message allows ("Save anyway"): it shows with the error, never without one, and moves under the message when the line is narrow.
invalid- boolean
disabled- boolean
- Disables the control and dims the label.
rootStyle- RootStyle
- Typed StyleX override: where the field sits.
Rest props go to <div> props.
nextLabel- string
- The primary's label on this step (default "Continue"; the last step's is the dialog's
submitLabel). canContinue- boolean
- Default:
true - The primary is enabled when true. Never false for a step that is not yet valid: its fields'
rules hold it on Continue and say what to fix (K30). onContinue- () => void | Promise<void>
- A check before the next step: throw a FormError to stay with a message. Nothing is sent by default.
description- ReactNode
- The dialog's description while this step shows (the consequence of the last step belongs on it).
openrequired- boolean
onOpenChangerequired- (open: boolean) => void
onSendrequired- (report: FeedbackReport) => Promise<void> | void
- Sends the report. Resolves once it is sent: "Sent" stands where Send stood, then the sheet closes and forgets the report. Rejects to say why: with a
FormErrorits message, under the field when it namestext; with anything else, "Not sent. Try again." The report stays as it was written. instant- boolean
- It was opened from the keyboard (a menu's row by Enter): it is there in one frame.
finalFocus- FocusTarget
- Where focus goes when it closes. Default: wherever it was before it opened.
container- PortalContainer
- Where a surface's portal mounts. Default:
document.body. Pass a themed subtree to keep itsdata-theme, or a transformed stage to containposition: fixedoverlays (previews): a modal set down in one stays in it, shown in place, out of the browser's top layer.
openrequired- boolean
onOpenChangerequired- (open: boolean) => void
onSendrequired- (report: ReportSubmission) => Promise<ReportReceipt | void> | ReportReceipt | void
- Sends the report. Resolves once recorded, and the sheet switches to one line of what happens next until closed: with
{ hidden: true }, where the product's server hid the item on this report, the line says it is hidden; with{ hidden: false }or nothing, it says when the report is looked at and claims nothing hidden. Rejects to explain why: aFormErrornaming a field puts the message beside it; anything else shows above the footer and keeps what was entered. kinds- readonly K[]
- The reasons this item can be reported for, by their values in
REPORT_KINDS, in the order the sheet shows them. Left out: all six. With one there is nothing to choose: the sheet names it. publicPage- boolean
- Default:
false - True when opened from a public page without signing in; adds the four required fields for intimate-image requests.
defaultKind- NoInfer<K>
- Default:
none - Pre-selected reason when opened from a specific link (for example a public intimate-image form): one of
kinds. instant- boolean
- Opened from the keyboard: appears in one frame.
finalFocus- FocusTarget
- Where focus goes when closed. Default: what opened it.
container- PortalContainer
- Where a surface's portal mounts. Default:
document.body. Pass a themed subtree to keep itsdata-theme, or a transformed stage to containposition: fixedoverlays (previews): a modal set down in one stays in it, shown in place, out of the browser's top layer.
State machine
Username
ada