Skip to content
SENVENLI UI

Form

A form with consistent rhythm, sections with legends, side-by-side rows and a footer for its actions.
A small form
import { Form, FormSection, FormRow, FormFooter } from "@senvenli/react/form";

Examples

Validation on submit

An invalid field takes focus and `onSubmit` is not called; entered values are kept.

Server errors

`validationErrors` marks fields by name until the person edits them.

Guidelines

When to use it

  • Collecting input that is submitted together.

Use something else when

  • One control needs a label, hint and error row outside a form. Field
  • The form is a short focused task over the page. Dialog

Do and avoid

  • One primary submit button in the FormFooter.
  • Mark the exception: required when most fields are optional, optional when most are required.

Accessibility

Keyboard

KeysWhat happens
EnterSubmits the form from a text field.

Built in

  • On submit, focus moves to the first invalid field.
  • FormSection is a fieldset named by its legend.

You provide

  • A legend for each FormSection.

API reference

Form

width
"full" | "narrow"Default "narrow"

narrow (default) caps single-column forms at 560px.

Also takes 77 standard DOM and ARIA attributes (id, aria-label, event handlers…).

FormSection

legendRequired
React.ReactNode

The section title (heading-small).

childrenRequired
React.ReactNode
isDisabled
boolean

FormRow

childrenRequired
React.ReactNode

FormFooter

childrenRequired
React.ReactNode