Skip to content

Dynamic form ​

A form built from configuration: its fields in order, then one action button.

repetitiveform-dynamicform--defaultOpen in Storybook ↗

When to use ​

  • Creating a record from a modal or drawer: Create asset, Create tag.
  • Uploads, imports and downloads that need a few values first.
  • A step in a guided flow that creates a record.

When not to use ​

  • Changing one value of an existing record: edit it in place in its field row.
  • Records that are created together and linked: use a guided flow.

Anatomy ​

  1. Title (optional): the form's label as a page title. In a modal without steps, the label is the modal title instead.
  2. Info line (optional): a short explanation under the title.
  3. Fields: one per configured field, in configured order. Each is a label over its input, the same as a field row in edit mode. A required field has a red asterisk after its label.
  4. Action button: always last, whatever the configured order. A full-width commit button with an optional icon. Upload actions use the upload button and progress banner instead.
  5. Error line (optional): the server's message under the button when the action fails.

In a modal, the upload button sits in a sticky zone at the bottom, above a --color-border-subtle line, so it stays in view while the fields scroll.

Variants ​

VariantWhereWhat changes
Single formmost create and action formsfields and one action button
Stepsa form with more than one taba numbered step strip on top; a Next action moves to the next step, the last step creates the records
With uploadupload and import formsa dropzone between the fields, an upload button with progress
With pickerrelation formsan entity picker as one of the fields
repetitiveform-dynamicform--stepsOpen in Storybook ↗

Steps can't be clicked. The strip only shows where you are: the current step is a filled accent circle with a bold label, done steps are a light accent circle, steps to come are grey. Next validates the current step before it moves on.

States ​

StateWhat you seeTrigger
Loadingskeleton blocks, or a spinner for an unknown formthe form opens
Readyempty or prefilled fields, button enabledloaded
Errorsa message under each invalid field; the button is disabled until they are fixedthe button is pressed with invalid fields
Workingthe button shows a spinner; other action buttons are disabledthe action runs
Failedan error notification, or the server's message under the button; the values staythe action fails
Donea success notification; the modal closes or the new record opensthe action succeeds
repetitiveform-dynamicform--statesOpen in Storybook ↗

Fields are not validated while you fill them in for the first time, unless a field is set to validate as you type. After the first press of the button, every change validates again, and the button enables as soon as the last error is fixed.

Keyboard & accessibility ​

  • Every input is a native field or a design-system input: Tab follows the configured order and ends on the action button.
  • An error message sits directly under its field.
  • One action runs at a time: pressing the button again while it works does nothing.
  • Closing a modal with unsaved changes asks first: Leave form with Leave and Cancel.

Content ​

  • The action label is a verb for what happens: Create, Upload, Download.
  • Field labels are nouns, in sentence case: Title, Date of birth.
  • Use the info line only when the form needs it, in one or two sentences.

Guided flow · Text input · Tooltip · Upload · Modal

Powered by Elody - Open Source Semantic Data Platform