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.
Props
NameTypeDefaultDescription

How it works

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

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.

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

Date picker

If you prefer, you can still use the browser's native, date-picker by setting the type props to 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.

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.

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.

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.

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.