Form

Basic

Form, FormField, FormFieldLabel, FormCheck, FormCheckLabel are the foundations of form layout. Components are smart and automatically link labels to form controls if a name is provided. A unique id is automatically generated, htmlFor is added to label and aria-labelledby attributes are added to controls.

Horizontal form

Create horizontal forms with the system by adding the row property to FormField and using the col property to specify the width of your labels and controls. FormFieldLabel are automatically vertically centered with their associated form controls when col is used. You can invert this behaviour by specifying py={0}.

Scaled forms

All components accept a property scale to scale properly with form controls.

Horizontal Radios & Checkboxes

Use orientation: "horizontal" on useRadioState and aria-orientation="horizontal" on RadioGroup and CheckboxGroup to display controls horizontally.

Accessibility

All forms components follow WAI-ARIA Pattern to ensure a complete accesibility of your forms.

  • Role form is automatically added to form if not a native form element
  • aria-labelledby is automatically added to label when a name is provided

API

Form

PropertyTypeRequiredDefaultDescription
childrennodefalse-
Show xstyled properties

FormField

PropertyTypeRequiredDefaultDescription
childrennodefalse-
scale
enum
falsebaseControl the size of the component.
Show xstyled properties

FormFieldLabel

PropertyTypeRequiredDefaultDescription
childrennodefalse-
scale
enum
falsebaseControl the size of the component.
Show xstyled properties

FormCheck

PropertyTypeRequiredDefaultDescription
childrennodefalse-

FormCheckLabel

PropertyTypeRequiredDefaultDescription
childrennodefalse-
scale
enum
falsebaseControl the size of the component.
Show xstyled properties