Digital pattern library

Form elements

Keep forms as simple as possible, see form example for more information.

Rules for form elements

Options available


Checkboxes inline

Example

Please choose one or more options:

Code

Please choose one or more options:


Checkboxes stacked

Example

Please choose one or more options:

Code

Please choose one or more options:


Checkboxes inline (small)

Smaller checkboxes can be used when these elements need to be less visually prominent.

Example

Please choose one or more options:

Code

Please choose one or more options:


Checkboxes stacked (small)

Smaller checkboxes can be used when these elements need to be less visually prominent.

Example

Please choose one or more options:

Code

Please choose one or more options:


Date picker

Use date picker for inputting date elements.

Example
Code
	

Fieldsets and legends

Use fieldsets to group related form controls. The first element inside a fieldset must be a legend element that describes the group.

Example
Personal details
Enter your postcode without any spaces. For example, KY169AL.
Code
Personal details
Enter your postcode without any spaces. For example, KY169AL.

File upload

This element uses the native input: type='file'. This is so the element gains focus when tabbing through the page. It also ensures the element functions when:

Example
Code
	

Hint text

Example
Enter your postcode without any spaces. For example, KY16 9AL.
Code
	
Enter your postcode without any spaces. For example, KY16 9AL.

Input addons

Addons may be used when the input field is always going to be prefixed with a particular value, for example collecting only the username for an @st-andrews.ac.uk email address.

Example
£
.00
@st-andrews.ac.uk
Code
	
£
.00
@st-andrews.ac.uk

Input fields

You must use the .form-group class to create spacing when wrapping label and input pairs.

Example
Code
	

Labels

Example
Code
	

Optional fields

If you do ask for optional information, you must mark the labels of optional fields with (optional).

Example
Code
	

Radio buttons inline

These let users choose a single option from a list.

Example

How many fudge doughnuts would you like?

Code

How many fudge doughnuts would you like?


Radio buttons stacked

These let users choose a single option from a list.

Example

How many fudge doughnuts would you like?

Code

How many fudge doughnuts would you like?


Radio buttons stacked with conditional

You may reveal an additional input field, depending on the radio button selected.

Example

How many fudge doughnuts would you like?

Code

How many fudge doughnuts would you like?


Select box

Example

Please select your student status.

Code

Please select your student status.


Select box with conditional

You may reveal an additional input field, depending on the option selected.

Example

Please select your student status.

Code

Please select your student status.


Submit buttons

Example
Code
	

Textarea

Allows for multiple lines of text.

Example
Code
	

Textarea with input limit counter

Example
Code