Components

Search box

Unofficial Experimental

A single-line, form field for searching, with submit button.

(Heavily inspired by the Search component in the GOV.UK Component Guide.)

Props
NameTypeDefaultDescription
idstring-'id' attribute to place on the base HTML element
classBlockstring-Block name override in BEM style classes applied to all elements
classModifiersModifiers-BEM style modifiers to apply to the base HTML element
classNamestring-Extra classes to apply to the base HTML element
suffixstring-Suffix to show after the field
buttonReactNodeSearchSubmit button text
errorReactNode-Error message
hintstring-Hint
labelstringSearchLabel

Stories

Standard

A standard Search box.

Custom label

Hint

If you provide a hint, it will be displayed instead of the label.

Custom submit button text

The text of the submit button is visually hidden, but can be customised for screen-readers.

Fixed width

Fluid width

Error

Currently errors are visually hidden, so it is best to avoid them. They will however be accessible to screen-readers, and the field will still be highlighted in red.

Disabled

Secondary button

A search box with a more subtle, grey button, similar to the 'secondary' button style.