Skip to content

Official government website An official website of the Federal Government of Nigeria

How you know
Federal Ministry of Communications, Innovation & Digital Economy Nigerian Design Standards

Text input

Lets people type a short answer on one line, such as a name, an email address, a phone number or a reference number.

Updated

Live example

Text input

As it appears on your ID

Controls
Property Control What it does
Type
Text for most answers. Phone adds +234
Default, active, error, disabled
Hint
Help text under the label
Required
Asterisk in the label row and native required
The question people answer

Overview

A text input lets people type a short answer on one line. Every field has a visible label, and a hint only when most people need help to answer.

Use a text input for

  • A short answer on one line, like a name or an email address
  • A Nigerian phone number (Phone type)
  • Searching the site or a list of services (Search field)

Don’t use a text input for

  • Answers longer than one line (use a textarea)
  • A choice from a list (use radios, a select or a combo box)
  • A person’s name in one “Full name” box (use an input group)

Types

Four components share the same field style. Pick the one that fits the answer.

As it appears on your ID

Text

Names, email addresses, reference numbers and NIN. Set the input type and autocomplete for each question.

We’ll only call if we need to ask about your message

Phone

Nigerian phone numbers. +234 is shown, so people type 10 digits.

Site or service search. No visible label: the placeholder says what it searches.

Your name

As it appears on your NIN slip

(optional)

Input group

One question in several fields, like First, Middle (optional) and Last name.

Specifications

The properties of Form/Input field. The same in HTML, WordPress and React.

Text input properties
Property Type Possible values Description
type string
  • text default
  • phone
Text for most answers. Phone shows a fixed +234 prefix, so people type 10 digits.
state string
  • default default
  • active
  • error
  • disabled
Active is the field in use: a 2px border/dark (not the keyboard focus ring). Error shows the error message and a red border. Avoid disabled where you can.
showLabel boolean
  • true default
  • false
Always on for form fields. The label says what to enter.
showHint boolean
  • true default
  • false
Help text under the control. Only when most people need it.
required boolean
  • false default
  • true
Shows an asterisk in the label row and sets the native required attribute. Use optional instead for “(optional)” when the field is not mandatory.

In code, use <label for> with the visible label, aria-describedby for the hint or error, and aria-invalid="true" in an error. Set type and autocomplete for each question.

Tokens

Text input tokens and contrast
Part Token Contrast on the page
Border border/strong, 1px 4.2:1
Border when active border/dark, 2px 14.3:1
Border in an error status/error/surface, 1px (2px when active) 4.9:1
Typed text text/primary, Body/medium (16px) 17.6:1
Disabled surface/muted fill, border/subtle, text/disabled Exempt
Corners · height · side padding radius/050 (4px) · spacing/500 (40px tall) · spacing/150 (12px sides) —

Use cases

Do

We’ll only call if we need to ask about your message

Size the field to the answer. A phone number field looks short, so people know what’s expected.

Don’t

Don’t use placeholder text as a label. It disappears when people type and is too light to read.

Layout

How fields are spaced and sized on a form.

8px inside a field
Between the label, the field and the hint or error.
32px between fields
Between questions. 24px between the fields inside an input group.
Size fields to the answer
Short answers like a phone number or NIN get short fields. On desktop the form sits in 6 of 12 columns.
Full width on mobile
Every field fills the width and is 40px tall, above the 24px minimum target.
16px typed text
Keep the typed text at 16px on every screen. It stops iPhones zooming into the field.

Copywriting

How to write labels, hints and error messages. Clear words help everyone fill in a form first time.

Say what to enter

Use a short noun phrase: “Email address”, not “Please enter your email”.

Mark optional fields

Put “(optional)” in the label. Don’t mark required fields with words.

Only add a hint when it helps

A format, or where to find a number. Not a repeat of the label.

Say how to fix an error

“Enter your first name”, not “Invalid input”. Keep what people typed.

Don’t use placeholders

Placeholder text disappears and is too light. Search is the only exception.

Ask for names in parts

First, Middle (optional) and Last name. Never one “Full name” box.

Examples

Text input copywriting examples
Write Don’t write Why
Email address Please enter your email address here Short, and says what to enter.
Middle name (optional) Middle name Says it can be left blank.
Enter your first name Invalid input Says how to fix it.
Enter a phone number, like 803 123 4567 Phone number is wrong Shows a format that works.
First name · Last name Full name Official forms ask for names in parts.

Accessibility

Built on native <input> elements with a visible <label>, so it works with keyboards, screen readers and browser autofill.

Keyboard interaction for text inputs
Key What it does
Tab Moves to the next field, in the order they appear.
Shift + Tab Moves back to the previous field.
Enter Submits the form. In a search field, runs the search.
  • Every field has a visible label linked with for/id (WCAG 1.3.1, 3.3.2).
  • Hints and errors are read with the label, using aria-describedby. Errors use words and a red border, not colour alone.
  • The field border is 4.2:1 and goes 2px when active, so it stands out (WCAG 1.4.11).
  • Fields are 40px tall, above the 24px minimum target (WCAG 2.5.8).
  • Type and autocomplete are set, so phones show the right keyboard and browsers can fill answers (WCAG 1.3.5).

For developers

Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.

For designers

Use Form/Input field, Form/Search field and Form/Input group from 01 Library – Foundations. Don’t detach them.

References

Feedback

Report a problem with this page