This is a new service that we're still developing. Try the service and send us your comments and suggestions. Your feedback will help make the service easier to use for everyone.

Input form groups

Use the text input component when you need to let users enter text that’s no longer than a single line, such as their name or phone number.

Input length should always be appropriate to the length of the text the user will enter. Input lengths can be altered by using field-width classes (.fw-xx).

Basic input form group

All text inputs must have visible labels; placeholder text is not an acceptable replacement for a label as it vanishes when users start typing.

Labels should be aligned above the text input they refer to. They should be short, direct and written in sentence case. Do not use colons at the end of labels.

Input form with Header as a Label

If you’re asking just one question per page as recommended, you can set the contents of the label as the page heading. This is good practice as it means that users of screen readers will only hear the contents once.

Use appropriately-sized text inputs

Help users understand what they should enter by making text inputs the right size for the content they’re intended for.

By default, the width of text inputs is fluid and will fit the full width of the container they are placed into.

If you want to make the input smaller, you can either use a fixed width input, or use the width override classes to create a smaller, fluid width input.

Fixed width inputs

Use fixed width inputs for content that has a specific, known length. Postcode inputs should be postcode-sized, telephone number inputs should be telephone number-sized.

On fixed width inputs, the width will remain fixed on all screens unless it is wider than the viewport, in which case it will shrink to fit.

HTML code

<div class="ns-form-group">
	<label class="ns-label" for="width-50">
		50 em (about 65 characters)
	</label>
	<input class="ns-input fw-50" id="width-50" name="width-50" type="text">
</div>

Examples

Input form group with hint text

Use hint for help that’s relevant to the majority of users, like how their information will be used, or where to find it.

The name you’ll use on promotional material.

Le nom que vous utiliserez sur le matériel promotionnel.

Prefixes and suffixes

Use prefixes and suffixes to help users enter things like currencies and measurements.

Prefixes and suffixes are useful when there’s a commonly understood symbol or abbreviation for the type of information you’re asking for. Do not rely on prefixes or suffixes alone, because people who use a screen reader won’t see them.

If you need a specific type of information, say so in the input label or hint text as well. For example, put “Cost, in dollars” in the input label and use the “$” symbol in the prefix.

Some users may miss the fact that the input already has a suffix or prefix, and enter a prefix or suffix into the input. Allow for this in your validation and do not show an error.

Consideration for bilingual services

On French page, for currency use the comma as the decimal marker in French texts and place the dollar sign after the numerals.

Error messages

Error messages should be styled like this:

The name you’ll use on promotional material.
Error: Enter an event name

Le nom que vous utiliserez sur le matériel promotionnel.
Erreur : Entrez le nom de l'événement.

Prefixes and suffixes with error

Error: Enter an cost per item

Erreur : Entrez le coût par article.