Components

Form field

Unofficial

A component for colecting a piece of data from the user. The type of form field that is rendered will depend on the props that are supplied to it. For example, providing a few options will cause it to render as some radio buttons.

Note: To use this as part of the wider forms framework, you should instead import the Form component and replace FormField in the examples below with Form.Field.

The name you’ll use on promotional material.
<div id="name" class="govuk-form-group">
  <label for="name-input" class="govuk-label">
    <h1 class="govuk-heading-l">
      What is the name of the event?
    </h1>
  </label>
  <span id="name-hint" class="govuk-hint">
    The name you’ll use on promotional material.
  </span>
  <input
    type="text"
    name="name"
    aria-describedby="name-hint"
    id="name-input"
    class="govuk-input"
  />
</div>
<FormField
  name="name"
  label={
    <h1 className="govuk-heading-l">
      What is the name of the event?
    </h1>
  }
  hint="The name you’ll use on promotional material."
/>
Props
Name Type Default Description
id string - 'id' attribute to place on the base HTML element HTML id (If not specified then the name will be used) HTML id (If not specified then the name will be used) HTML id (If not specified then the name will be used) HTML id (If not specified then the name will be used)
classBlock string - Block name override in BEM style classes applied to all elements
classModifiers other - BEM style modifiers to apply to the base HTML element
className string - Extra classes to apply to the base HTML element
accept string -
alt string -
autoComplete string -
autoFocus boolean -
capture other -
checked boolean -
crossOrigin string -
disabled boolean -
form string -
formAction string -
formEncType string -
formMethod string -
formNoValidate boolean -
formTarget string -
height other -
list string -
max other -
maxLength number -
min other -
minLength number -
multiple boolean -
name string -
pattern string -
placeholder string -
readOnly boolean -
required boolean -
size number -
src string -
step other -
type string -
value other - Value for controlled fields
width other - Width of the field in characters (approximate) Width of the field in characters (approximate) Width of the field in characters (approximate)
onChange function -
defaultChecked boolean -
defaultValue other - Initial value of the field
suppressContentEditableWarning boolean -
suppressHydrationWarning boolean -
accessKey string -
contentEditable other -
contextMenu string -
dir string -
draggable other -
hidden boolean -
lang string -
slot string -
spellCheck other -
style other -
tabIndex number -
title string -
translate enum -
radioGroup string -
role string -
about string -
datatype string -
inlist other -
prefix string - Prefix to show before the field
property string -
resource string -
typeof string -
vocab string -
autoCapitalize string -
autoCorrect string -
autoSave string -
color string -
itemProp string -
itemScope boolean -
itemType string -
itemID string -
itemRef string -
results number -
security string -
unselectable enum -
inputMode enum - Hints at the type of data that might be entered by the user while editing the element or its contents
is string - Specify that a standard HTML element should behave like a defined custom built-in element
aria-activedescendant string - Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
aria-atomic other - Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
aria-autocomplete enum - Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.
aria-busy other - Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.
aria-checked other - Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-colcount number - Defines the total number of columns in a table, grid, or treegrid.
aria-colindex number - Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
aria-colspan number - Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
aria-controls string - Identifies the element (or elements) whose contents or presence are controlled by the current element.
aria-current other - Indicates the element that represents the current item within a container or set of related elements.
aria-describedby string - Identifies the element (or elements) that describes the object.
aria-details string - Identifies the element that provides a detailed, extended description for the object.
aria-disabled other - Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
aria-dropeffect enum - Indicates what functions can be performed when a dragged object is released on the drop target.
aria-errormessage string - Identifies the element that provides an error message for the object.
aria-expanded other - Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-flowto string - Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.
aria-grabbed other - Indicates an element's "grabbed" state in a drag-and-drop operation.
aria-haspopup other - Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-hidden other - Indicates whether the element is exposed to an accessibility API.
aria-invalid other - Indicates the entered value does not conform to the format expected by the application.
aria-keyshortcuts string - Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
aria-label string - Defines a string value that labels the current element.
aria-labelledby string - Identifies the element (or elements) that labels the current element.
aria-level number - Defines the hierarchical level of an element within a structure.
aria-live enum - Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
aria-modal other - Indicates whether an element is modal when displayed.
aria-multiline other - Indicates whether a text box accepts multiple lines of input or only a single line.
aria-multiselectable other - Indicates that the user may select more than one item from the current selectable descendants.
aria-orientation enum - Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
aria-owns string - Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
aria-placeholder string - Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
aria-posinset number - Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
aria-pressed other - Indicates the current "pressed" state of toggle buttons.
aria-readonly other - Indicates that the element is not editable, but is otherwise operable.
aria-relevant enum - Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
aria-required other - Indicates that user input is required on the element before a form may be submitted.
aria-roledescription string - Defines a human-readable, author-localized description for the role of an element.
aria-rowcount number - Defines the total number of rows in a table, grid, or treegrid.
aria-rowindex number - Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
aria-rowspan number - Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
aria-selected other - Indicates the current "selected" state of various widgets.
aria-setsize number - Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
aria-sort enum - Indicates if items in a table or grid are sorted in ascending or descending order.
aria-valuemax number - Defines the maximum allowed value for a range widget.
aria-valuemin number - Defines the minimum allowed value for a range widget.
aria-valuenow number - Defines the current value for a range widget.
aria-valuetext string - Defines the human readable text alternative of aria-valuenow for a range widget.
dangerouslySetInnerHTML other -
onCopy function -
onCopyCapture function -
onCut function -
onCutCapture function -
onPaste function -
onPasteCapture function -
onCompositionEnd function -
onCompositionEndCapture function -
onCompositionStart function -
onCompositionStartCapture function -
onCompositionUpdate function -
onCompositionUpdateCapture function -
onFocus function -
onFocusCapture function -
onBlur function -
onBlurCapture function -
onChangeCapture function -
onBeforeInput function -
onBeforeInputCapture function -
onInput function -
onInputCapture function -
onReset function -
onResetCapture function -
onSubmit function -
onSubmitCapture function -
onInvalid function -
onInvalidCapture function -
onLoad function -
onLoadCapture function -
onError function -
onErrorCapture function -
onKeyDown function -
onKeyDownCapture function -
onKeyPress function -
onKeyPressCapture function -
onKeyUp function -
onKeyUpCapture function -
onAbort function -
onAbortCapture function -
onCanPlay function -
onCanPlayCapture function -
onCanPlayThrough function -
onCanPlayThroughCapture function -
onDurationChange function -
onDurationChangeCapture function -
onEmptied function -
onEmptiedCapture function -
onEncrypted function -
onEncryptedCapture function -
onEnded function -
onEndedCapture function -
onLoadedData function -
onLoadedDataCapture function -
onLoadedMetadata function -
onLoadedMetadataCapture function -
onLoadStart function -
onLoadStartCapture function -
onPause function -
onPauseCapture function -
onPlay function -
onPlayCapture function -
onPlaying function -
onPlayingCapture function -
onProgress function -
onProgressCapture function -
onRateChange function -
onRateChangeCapture function -
onSeeked function -
onSeekedCapture function -
onSeeking function -
onSeekingCapture function -
onStalled function -
onStalledCapture function -
onSuspend function -
onSuspendCapture function -
onTimeUpdate function -
onTimeUpdateCapture function -
onVolumeChange function -
onVolumeChangeCapture function -
onWaiting function -
onWaitingCapture function -
onAuxClick function -
onAuxClickCapture function -
onClick function -
onClickCapture function -
onContextMenu function -
onContextMenuCapture function -
onDoubleClick function -
onDoubleClickCapture function -
onDrag function -
onDragCapture function -
onDragEnd function -
onDragEndCapture function -
onDragEnter function -
onDragEnterCapture function -
onDragExit function -
onDragExitCapture function -
onDragLeave function -
onDragLeaveCapture function -
onDragOver function -
onDragOverCapture function -
onDragStart function -
onDragStartCapture function -
onDrop function -
onDropCapture function -
onMouseDown function -
onMouseDownCapture function -
onMouseEnter function -
onMouseLeave function -
onMouseMove function -
onMouseMoveCapture function -
onMouseOut function -
onMouseOutCapture function -
onMouseOver function -
onMouseOverCapture function -
onMouseUp function -
onMouseUpCapture function -
onSelect function -
onSelectCapture function -
onTouchCancel function -
onTouchCancelCapture function -
onTouchEnd function -
onTouchEndCapture function -
onTouchMove function -
onTouchMoveCapture function -
onTouchStart function -
onTouchStartCapture function -
onPointerDown function -
onPointerDownCapture function -
onPointerMove function -
onPointerMoveCapture function -
onPointerUp function -
onPointerUpCapture function -
onPointerCancel function -
onPointerCancelCapture function -
onPointerEnter function -
onPointerEnterCapture function -
onPointerLeave function -
onPointerLeaveCapture function -
onPointerOver function -
onPointerOverCapture function -
onPointerOut function -
onPointerOutCapture function -
onGotPointerCapture function -
onGotPointerCaptureCapture function -
onLostPointerCapture function -
onLostPointerCaptureCapture function -
onScroll function -
onScrollCapture function -
onWheel function -
onWheelCapture function -
onAnimationStart function -
onAnimationStartCapture function -
onAnimationEnd function -
onAnimationEndCapture function -
onAnimationIteration function -
onAnimationIterationCapture function -
onTransitionEnd function -
onTransitionEndCapture function -
error other - Error message Error message Error message Error message Error message Error message
hint other - Hint Hint Hint Hint Hint Hint
label other - REQUIRED. Label Label Label Label Label Label Label
options other - REQUIRED. List of options to select from List of options to select from List of options to select from List of options to select from
suffix string - Suffix to show after the field
rows number -
cols number -
dirName string -
wrap string -

How it works

With minimal props it will render as a simple text field.

The name you’ll use on promotional material.
<div id="name" class="govuk-form-group">
  <label for="name-input" class="govuk-label">
    <h1 class="govuk-heading-l">
      What is the name of the event?
    </h1>
  </label>
  <span id="name-hint" class="govuk-hint">
    The name you’ll use on promotional material.
  </span>
  <input
    type="text"
    name="name"
    aria-describedby="name-hint"
    id="name-input"
    class="govuk-input"
  />
</div>
<FormField
  name="name"
  label={
    <h1 className="govuk-heading-l">
      What is the name of the event?
    </h1>
  }
  hint="The name you’ll use on promotional material."
/>

Multi-line

By adding a rows prop that is greater than 1 we get a textarea of that size.

This will be displayed on promotional material.
<div id="desc" class="govuk-form-group">
  <label for="desc-input" class="govuk-label">
    <h1 class="govuk-heading-l">
      How would you describe the event?
    </h1>
  </label>
  <span id="desc-hint" class="govuk-hint">
    This will be displayed on promotional material.
  </span>
  <textarea
    name="desc"
    aria-describedby="desc-hint"
    class="govuk-textarea"
    id="desc-input"
    rows="3"
  ></textarea>
</div>
<FormField
  name="desc"
  label={
    <h1 className="govuk-heading-l">
      How would you describe the event?
    </h1>
  }
  hint="This will be displayed on promotional material."
  rows={3}
/>

Dates

It's also possible to force a certain rendering mode by using the type prop. The most common use for this is to ask for dates by setting it to date.

When is the event?

For example, 12 11 2007
<div id="date" class="govuk-form-group">
  <fieldset
    aria-describedby="date-hint"
    class="govuk-fieldset"
  >
    <legend class="govuk-fieldset__legend">
      <h1 class="govuk-heading-l">
        When is the event?
      </h1>
    </legend>
    <span id="date-hint" class="govuk-hint">
      For example, 12 11 2007
    </span>
    <div class="govuk-date-input">
      <div class="govuk-date-input__item">
        <label for="date-day" class="govuk-label">
          Day
        </label>
        <input
          type="text"
          id="date-day"
          name="date[day]"
          pattern="[0-9]*"
          inputmode="numeric"
          class="govuk-input govuk-input--width-2 govuk-date-input__input"
        />
      </div>
      <div class="govuk-date-input__item">
        <label for="date-month" class="govuk-label">
          Month
        </label>
        <input
          type="text"
          id="date-month"
          name="date[month]"
          pattern="[0-9]*"
          inputmode="numeric"
          class="govuk-input govuk-input--width-2 govuk-date-input__input"
        />
      </div>
      <div class="govuk-date-input__item">
        <label for="date-year" class="govuk-label">
          Year
        </label>
        <input
          type="text"
          id="date-year"
          name="date[year]"
          pattern="[0-9]*"
          inputmode="numeric"
          class="govuk-input govuk-input--width-4 govuk-date-input__input"
        />
      </div>
    </div>
  </fieldset>
</div>
<FormField
  name="date"
  label={
    <h1 className="govuk-heading-l">
      When is the event?
    </h1>
  }
  type="date"
/>

Date picker

If you prefer, you can still use the browser's native, date-picker by setting the type props to native-date.

<div id="date" class="govuk-form-group">
  <label for="date-input" class="govuk-label">
    <h1 class="govuk-heading-l">
      When is the event?
    </h1>
  </label>
  <input
    type="date"
    name="date"
    id="date-input"
    class="govuk-input"
  />
</div>
<FormField
  name="date"
  label={
    <h1 className="govuk-heading-l">
      When is the event?
    </h1>
  }
  type="native-date"
/>

Selecting from options

If you want the user to only answer from a list of options just provide an options prop.

A single choice from few options

Providing very few option will give you radios.

Is it suitable for under-18s?

Select 'No' if there will be any explicit content.
<div id="age-restricted" class="govuk-form-group">
  <fieldset
    aria-describedby="age-restricted-hint"
    class="govuk-fieldset"
  >
    <legend class="govuk-fieldset__legend">
      <h1 class="govuk-heading-l">
        Is it suitable for under-18s?
      </h1>
    </legend>
    <span id="age-restricted-hint" class="govuk-hint">
      Select &#x27;No&#x27; if there will be any
      explicit content.
    </span>
    <div class="govuk-radios govuk-radios--inline">
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="1"
          name="age-restricted"
          id="age-restricted-radio-0"
          class="govuk-radios__input"
        />
        <label
          for="age-restricted-radio-0"
          class="govuk-label govuk-radios__label"
        >
          Yes
        </label>
      </div>
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="0"
          name="age-restricted"
          id="age-restricted-radio-1"
          class="govuk-radios__input"
        />
        <label
          for="age-restricted-radio-1"
          class="govuk-label govuk-radios__label"
        >
          No
        </label>
      </div>
    </div>
  </fieldset>
</div>
<FormField
  name="age-restricted"
  label={
    <h1 className="govuk-heading-l">
      Is it suitable for under-18s?
    </h1>
  }
  hint="Select 'No' if there will be any explicit content."
  options={[
    {
      value: "1",
      label: "Yes",
    },
    {
      value: "0",
      label: "No",
    },
  ]}
  classModifiers="inline"
/>

A single choice from more options

Providing more options will give you small radios.

Where will the event take place?

Select the country in which the event will be held.
<div id="location" class="govuk-form-group">
  <fieldset
    aria-describedby="location-hint"
    class="govuk-fieldset"
  >
    <legend class="govuk-fieldset__legend">
      <h1 class="govuk-heading-l">
        Where will the event take place?
      </h1>
    </legend>
    <span id="location-hint" class="govuk-hint">
      Select the country in which the event will be
      held.
    </span>
    <div class="govuk-radios govuk-radios--small">
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="fr"
          name="location"
          id="location-radio-0"
          class="govuk-radios__input"
        />
        <label
          for="location-radio-0"
          class="govuk-label govuk-radios__label"
        >
          France
        </label>
      </div>
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="de"
          name="location"
          id="location-radio-1"
          class="govuk-radios__input"
        />
        <label
          for="location-radio-1"
          class="govuk-label govuk-radios__label"
        >
          Germany
        </label>
      </div>
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="ie"
          name="location"
          id="location-radio-2"
          class="govuk-radios__input"
        />
        <label
          for="location-radio-2"
          class="govuk-label govuk-radios__label"
        >
          Republic of Ireland
        </label>
      </div>
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="pt"
          name="location"
          id="location-radio-3"
          class="govuk-radios__input"
        />
        <label
          for="location-radio-3"
          class="govuk-label govuk-radios__label"
        >
          Portugal
        </label>
      </div>
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="es"
          name="location"
          id="location-radio-4"
          class="govuk-radios__input"
        />
        <label
          for="location-radio-4"
          class="govuk-label govuk-radios__label"
        >
          Spain
        </label>
      </div>
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="nl"
          name="location"
          id="location-radio-5"
          class="govuk-radios__input"
        />
        <label
          for="location-radio-5"
          class="govuk-label govuk-radios__label"
        >
          The Netherlands
        </label>
      </div>
      <div class="govuk-radios__item">
        <input
          type="radio"
          value="gb"
          name="location"
          id="location-radio-6"
          class="govuk-radios__input"
          checked=""
        />
        <label
          for="location-radio-6"
          class="govuk-label govuk-radios__label"
        >
          United Kingdom
        </label>
      </div>
    </div>
  </fieldset>
</div>
<FormField
  name="location"
  label={
    <h1 className="govuk-heading-l">
      Where will the event take place?
    </h1>
  }
  hint="Select the country in which the event will be held."
  options={[
    {
      value: "fr",
      label: "France",
    },
    {
      value: "de",
      label: "Germany",
    },
    {
      value: "ie",
      label: "Republic of Ireland",
    },
    {
      value: "pt",
      label: "Portugal",
    },
    {
      value: "es",
      label: "Spain",
    },
    {
      value: "nl",
      label: "The Netherlands",
    },
    {
      value: "gb",
      label: "United Kingdom",
      selected: true,
    },
  ]}
/>

A single choice from more options

Providing lots of options will give you a select box. (Note that these do not test well with users!)

Select the country in which the event will be held.
<div id="location" class="govuk-form-group">
  <label for="location-input" class="govuk-label">
    <h1 class="govuk-heading-l">
      Where will the event take place?
    </h1>
  </label>
  <span id="location-hint" class="govuk-hint">
    Select the country in which the event will be
    held.
  </span>
  <select
    name="location"
    aria-describedby="location-hint"
    class="govuk-select"
    id="location-input"
  >
    <option value="bg" label="Bulgaria">
      Bulgaria
    </option>
    <option value="cz" label="Czech Republic">
      Czech Republic
    </option>
    <option value="fr" label="France">France</option>
    <option value="de" label="Germany">
      Germany
    </option>
    <option value="fi" label="Finland">
      Finland
    </option>
    <option value="hu" label="Hungary">
      Hungary
    </option>
    <option value="it" label="Italy">Italy</option>
    <option value="ie" label="Republic of Ireland">
      Republic of Ireland
    </option>
    <option value="ro" label="Romania">
      Romania
    </option>
    <option value="no" label="Norway">Norway</option>
    <option value="pl" label="Poland">Poland</option>
    <option value="pt" label="Portugal">
      Portugal
    </option>
    <option value="ru" label="Russia">Russia</option>
    <option value="sk" label="Slovakia">
      Slovakia
    </option>
    <option value="si" label="Slovenia">
      Slovenia
    </option>
    <option value="es" label="Spain">Spain</option>
    <option value="se" label="Sweden">Sweden</option>
    <option value="ch" label="Switzerland">
      Switzerland
    </option>
    <option value="nl" label="The Netherlands">
      The Netherlands
    </option>
    <option value="ua" label="Ukraine">
      Ukraine
    </option>
    <option
      value="gb"
      label="United Kingdom"
      selected=""
    >
      United Kingdom
    </option>
  </select>
</div>
<FormField
  name="location"
  label={
    <h1 className="govuk-heading-l">
      Where will the event take place?
    </h1>
  }
  hint="Select the country in which the event will be held."
  options={[
    {
      value: "bg",
      label: "Bulgaria",
    },
    {
      value: "cz",
      label: "Czech Republic",
    },
    {
      value: "fr",
      label: "France",
    },
    {
      value: "de",
      label: "Germany",
    },
    {
      value: "fi",
      label: "Finland",
    },
    {
      value: "hu",
      label: "Hungary",
    },
    {
      value: "it",
      label: "Italy",
    },
    {
      value: "ie",
      label: "Republic of Ireland",
    },
    {
      value: "ro",
      label: "Romania",
    },
    {
      value: "no",
      label: "Norway",
    },
    {
      value: "pl",
      label: "Poland",
    },
    {
      value: "pt",
      label: "Portugal",
    },
    {
      value: "ru",
      label: "Russia",
    },
    {
      value: "sk",
      label: "Slovakia",
    },
    {
      value: "si",
      label: "Slovenia",
    },
    {
      value: "es",
      label: "Spain",
    },
    {
      value: "se",
      label: "Sweden",
    },
    {
      value: "ch",
      label: "Switzerland",
    },
    {
      value: "nl",
      label: "The Netherlands",
    },
    {
      value: "ua",
      label: "Ukraine",
    },
    {
      value: "gb",
      label: "United Kingdom",
      selected: true,
    },
  ]}
/>

Multiple choices

If you want the user to be able to select multiple options just add the multiple prop.

Where will the event take place?

Select all countries that will be hosting the event.
<div id="location" class="govuk-form-group">
  <fieldset
    aria-describedby="location-hint"
    class="govuk-fieldset"
  >
    <legend class="govuk-fieldset__legend">
      <h1 class="govuk-heading-l">
        Where will the event take place?
      </h1>
    </legend>
    <span id="location-hint" class="govuk-hint">
      Select all countries that will be hosting the
      event.
    </span>
    <div
      class="govuk-checkboxes govuk-checkboxes--small"
    >
      <div class="govuk-checkboxes__item">
        <input
          type="checkbox"
          value="fr"
          name="location"
          id="location-checkbox-0"
          class="govuk-checkboxes__input"
        />
        <label
          for="location-checkbox-0"
          class="govuk-label govuk-checkboxes__label"
        >
          France
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input
          type="checkbox"
          value="de"
          name="location"
          id="location-checkbox-1"
          class="govuk-checkboxes__input"
        />
        <label
          for="location-checkbox-1"
          class="govuk-label govuk-checkboxes__label"
        >
          Germany
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input
          type="checkbox"
          value="ie"
          name="location"
          id="location-checkbox-2"
          class="govuk-checkboxes__input"
        />
        <label
          for="location-checkbox-2"
          class="govuk-label govuk-checkboxes__label"
        >
          Republic of Ireland
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input
          type="checkbox"
          value="pt"
          name="location"
          id="location-checkbox-3"
          class="govuk-checkboxes__input"
        />
        <label
          for="location-checkbox-3"
          class="govuk-label govuk-checkboxes__label"
        >
          Portugal
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input
          type="checkbox"
          value="es"
          name="location"
          id="location-checkbox-4"
          class="govuk-checkboxes__input"
        />
        <label
          for="location-checkbox-4"
          class="govuk-label govuk-checkboxes__label"
        >
          Spain
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input
          type="checkbox"
          value="nl"
          name="location"
          id="location-checkbox-5"
          class="govuk-checkboxes__input"
        />
        <label
          for="location-checkbox-5"
          class="govuk-label govuk-checkboxes__label"
        >
          The Netherlands
        </label>
      </div>
      <div class="govuk-checkboxes__item">
        <input
          type="checkbox"
          value="gb"
          name="location"
          id="location-checkbox-6"
          class="govuk-checkboxes__input"
          checked=""
        />
        <label
          for="location-checkbox-6"
          class="govuk-label govuk-checkboxes__label"
        >
          United Kingdom
        </label>
      </div>
    </div>
  </fieldset>
</div>
<FormField
  name="location"
  label={
    <h1 className="govuk-heading-l">
      Where will the event take place?
    </h1>
  }
  hint="Select all countries that will be hosting the event."
  options={[
    {
      value: "fr",
      label: "France",
    },
    {
      value: "de",
      label: "Germany",
    },
    {
      value: "ie",
      label: "Republic of Ireland",
    },
    {
      value: "pt",
      label: "Portugal",
    },
    {
      value: "es",
      label: "Spain",
    },
    {
      value: "nl",
      label: "The Netherlands",
    },
    {
      value: "gb",
      label: "United Kingdom",
      selected: true,
    },
  ]}
  multiple
/>

Multiple choices from many options

If you provide a lot of options you will get a muilt-select box. (Note that these do not test well with users!)

Select all countries that will be hosting the event.
<div id="location" class="govuk-form-group">
  <label for="location-input" class="govuk-label">
    <h1 class="govuk-heading-l">
      Where will the event take place?
    </h1>
  </label>
  <span id="location-hint" class="govuk-hint">
    Select all countries that will be hosting the
    event.
  </span>
  <select
    name="location"
    multiple=""
    size="8"
    aria-describedby="location-hint"
    class="govuk-select"
    id="location-input"
  >
    <option value="bg" label="Bulgaria">
      Bulgaria
    </option>
    <option value="cz" label="Czech Republic">
      Czech Republic
    </option>
    <option value="fr" label="France">France</option>
    <option value="de" label="Germany">
      Germany
    </option>
    <option value="fi" label="Finland">
      Finland
    </option>
    <option value="hu" label="Hungary">
      Hungary
    </option>
    <option value="it" label="Italy">Italy</option>
    <option value="ie" label="Republic of Ireland">
      Republic of Ireland
    </option>
    <option value="ro" label="Romania">
      Romania
    </option>
    <option value="no" label="Norway">Norway</option>
    <option value="pl" label="Poland">Poland</option>
    <option value="pt" label="Portugal">
      Portugal
    </option>
    <option value="ru" label="Russia">Russia</option>
    <option value="sk" label="Slovakia">
      Slovakia
    </option>
    <option value="si" label="Slovenia">
      Slovenia
    </option>
    <option value="es" label="Spain">Spain</option>
    <option value="se" label="Sweden">Sweden</option>
    <option value="ch" label="Switzerland">
      Switzerland
    </option>
    <option value="nl" label="The Netherlands">
      The Netherlands
    </option>
    <option value="ua" label="Ukraine">
      Ukraine
    </option>
    <option
      value="gb"
      label="United Kingdom"
      selected=""
    >
      United Kingdom
    </option>
  </select>
</div>
<FormField
  name="location"
  label={
    <h1 className="govuk-heading-l">
      Where will the event take place?
    </h1>
  }
  hint="Select all countries that will be hosting the event."
  options={[
    {
      value: "bg",
      label: "Bulgaria",
    },
    {
      value: "cz",
      label: "Czech Republic",
    },
    {
      value: "fr",
      label: "France",
    },
    {
      value: "de",
      label: "Germany",
    },
    {
      value: "fi",
      label: "Finland",
    },
    {
      value: "hu",
      label: "Hungary",
    },
    {
      value: "it",
      label: "Italy",
    },
    {
      value: "ie",
      label: "Republic of Ireland",
    },
    {
      value: "ro",
      label: "Romania",
    },
    {
      value: "no",
      label: "Norway",
    },
    {
      value: "pl",
      label: "Poland",
    },
    {
      value: "pt",
      label: "Portugal",
    },
    {
      value: "ru",
      label: "Russia",
    },
    {
      value: "sk",
      label: "Slovakia",
    },
    {
      value: "si",
      label: "Slovenia",
    },
    {
      value: "es",
      label: "Spain",
    },
    {
      value: "se",
      label: "Sweden",
    },
    {
      value: "ch",
      label: "Switzerland",
    },
    {
      value: "nl",
      label: "The Netherlands",
    },
    {
      value: "ua",
      label: "Ukraine",
    },
    {
      value: "gb",
      label: "United Kingdom",
      selected: true,
    },
  ]}
  multiple
  size={8}
/>