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

Search field

Lets people search the whole site, or a long list like services, news or publications. It sits in the header or at the top of a results page.

Updated

Live example

Search field
Controls
Property Control What it does
Default, active (focused), disabled
Label
Show the label on a search results page

Overview

A search field is a text input with a search button. The placeholder says what it searches, and a hidden label gives screen readers the same words.

Use a search field for

  • Searching the whole site from the header
  • Searching a long list, like services, news or publications
  • A search results page, with the label shown

Don’t use a search field for

  • Filtering a short list people can scan (show the list)
  • A question on a form (use a text input)
  • Picking one answer from a long list (use a combo box)

States

Three states, and an option to show the label. Once people type, a Clear button appears so they can start again.

Default

The placeholder says what the field searches.

Active

Focused, with a 2px border. The Clear button shows once people type.

Disabled

Use rarely. If search can’t be used, hide it instead.

With label

On a search results page, show the label so people know what they searched.

Specifications

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

Search field properties
Property Type Possible values Description
state string
  • default default
  • active
  • disabled
Active is focus, from the browser. There’s no error state: an empty search shows a message, not an error.
showLabel boolean
  • false default
  • true
Off in the header, where the label is visually hidden. On for a search results page.
placeholder string
  • Search website default
Says what it searches, like “Search services”. Search is the only field that uses a placeholder.

In code, wrap the field in <form role="search">, give the input a <label> (visually hidden when showLabel is off), and make the search button a real submit button with aria-label="Search". Hide the browser’s own clear button.

Tokens

Search field 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
Search button surface/muted fill, text/primary icon, 40 × 40 Over 16.4:1 for the icon
Placeholder text/muted, Body/medium 6.6:1
Typed text text/primary, Body/medium (16px) 17.6:1
Corners · height radius/050 (4px) · spacing/500 (40px tall) —

Use cases

Do

Say what it searches in the placeholder, like “Search services” or “Search news”.

Don’t

Don’t show a disabled search field. If search can’t be used, hide it.

Layout

Where the search field sits on a page.

In the header
Right of the organisation name on desktop. On mobile, a search button opens the field.
Above the results
On a results page, put it above the results, with the label shown and the number of results.
40px tall
The field and the button are 40px, above the 24px minimum target.
16px typed text
Keep typed text at 16px on every screen. It stops iPhones zooming into the field.

Copywriting

How to write the placeholder and the results messages.

Say what it searches

“Search services”, not “Search…” or “Type here”.

Show what people searched

On the results page: “12 results for ‘passport’”.

Help when nothing is found

Suggest checking the spelling, and link to the full list.

Examples

Search field copywriting examples
Write Don’t write Why
Search services Search... Says what it searches.
12 results for ‘passport’ Results Confirms what was searched.
No results for ‘pasport’. Check the spelling or browse all services. Nothing found Says how to recover.

Accessibility

Built on a native input type="search" inside form role="search", so screen readers list it as the page’s search landmark.

Keyboard interaction for Search field
Key What it does
Tab Moves to the field, then to the Clear and Search buttons.
Enter Runs the search.
Esc Clears the field in most browsers.
  • The search landmark (role="search") lets screen reader users jump straight to it (WCAG 1.3.1).
  • A label is always in the code, visually hidden in the header, so the field has a name (WCAG 4.1.2).
  • The Clear and Search buttons have names, “Clear search” and “Search” (WCAG 4.1.2).
  • The field and buttons are 40px tall, above the 24px minimum target (WCAG 2.5.8).
  • The placeholder is 6.6:1, so it stays readable (WCAG 1.4.3).

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 Search field from the NDS Website documentation frames. Match node 900:178577 for states, tokens and copy.

References

Report a problem with this page