Design system/Patterns
Form layout and validation
A form in Flowra is a single column, with floating fields and 14px spacing; short labels, hints under the field, errors only on the field they're about, and a submit button that stays enabled until the person presses it.
In codecomponents/text-field.tsxapp/login/page.tsxcomponents/knowledge/ui.tsx (Dialog)
Live example
Press “Submit” to see validation; after the first submit, each field corrects itself as you type.
Layout
Field spacing
14pxgap-3.5 in the Dialog bodyField
58px · compact 44pxTouch: font 16pxHelp
11.5px · var(--text-secondary) · margin-top 5pxAA: 5.14 to 1 on a light cardColumns
1Two columns only for a short pair like date and timeButtons
Dialog footer · flex-1 · ghost, then dark- Field order follows the order people think in: first what, then for whom, then when.
- Few optional fields, and last; the shorter the form, the more finished it feels.
- The required mark is the requiredMark asterisk; if every field is required, none gets an asterisk.
- Independent options come as boxed Checkboxes under the fields.
When to validate
- No error is shown before the first “Submit”; someone who's still typing hasn't made a mistake.
- After the first submit, each field is revalidated as it's typed in, so the error disappears the moment it's fixed.
- The submit button stays enabled with a wrong value, and pressing it names the problem field; only an empty required field disables the button.
- A server error goes back to its own field if it's about one field; otherwise it's one sentence above the buttons.
- A wrong password is about the username and password pair, so both get marked.
Rules
Do
“This email address isn't complete.” under that field.
Don't
“The form is invalid.” at the top of the form.
Do
Keep what the person entered and just say what's missing.
Don't
Clearing the wrong field.
Do
For a suggestion, a fix button: “Use mehran”.
Don't
Auto-correcting someone's username or password without asking.
Related pages