Creating and editing
A form that adds or changes a record: where it opens, its fields, saving, and leaving with unsaved edits.
When it applies
- Someone adds a record or changes its details in a form.
- A long form, or a record read beside the page, opens in a Drawer. A short task that holds the page until it is done opens in a Dialog.
Components
What makes the pattern. Each component's own page has its examples and props.
| Component | What it does here |
|---|---|
| Drawer | The panel a long form opens in. |
| Dialog | A short edit, and the Discard changes? question. |
| Field | Every control's label, hint and error. |
| Input | One line of text. |
| Textarea | Several lines, like a note. |
| Select | One value from a list a person can scan. |
| Date Input | A date known by heart, like a date of birth. |
| Date Picker | A date near today, like a due date. |
| Toast | Confirms the save. |
Rules
Each comes from AGENTS.md or a component's own best practices, gathered for this job.
| Guidance | Practice |
|---|---|
| Do | Wrap every form control in a Field, so the label names it and the error is announced. |
| Do | Use DateInput for a date people know by heart or read off a document, with max set to today when it can't be in the future. Use DatePicker for a date near today. |
| Do | Set dismissible={false} on the drawer while it holds unsaved edits, and ask Discard changes? in onDismissAttempt. |
| Do | Confirm the save with toast, with a title that says what happened, like "Record saved". |
| Do | Start a control with defaultValue, or hold it with value and onValueChange. Never both. |
| Don't | Use a Select for two or three options a person compares, like Yes or No. Use RadioGroup or SegmentedControl. |
| Don't | Use a Dialog for a long form or a whole record. Use Drawer, the CRM's side panel. |
| Don't | Use a placeholder in place of a label. Every control has a label, or an aria-label where there is no visible text. |
See it
- Form panel: A form in a panel over the list: fields in one column, pairs side by side, and Cancel and Save in the panel's footer.