Skip to content

PostcodeFieldProps

The props of PostcodeField. Each one sets the attribute of the same name on the element, and spec/field.md defines each one.

readonly optional apiKey?: string

A publishable key. Without a key, the field sends no request.


readonly optional baseUrl?: string

The gateway’s address. The default is NIPOST’s gateway.


readonly optional confirm?: "none" | "level1" | "level2"

The lookup level of the check: none, level1 or level2. The default is level1.


readonly optional defaultValue?: string

The text in the input at first. The user changes it from then on.


readonly optional disabled?: boolean

True turns the field off, and the form leaves it out.


readonly optional gps?: boolean

True shows the location button, when the field has a key.


readonly optional label?: string

The visible label. The default is Postcode.


readonly optional legacy?: "accept" | "reject"

Whether an old 6-digit postcode is a form value. The default is accept.


readonly optional messages?: Partial<Readonly<Record<MessageKey, string>>>

Messages that replace the English ones, by key.


readonly optional name?: string

The name of the form value.


readonly optional onChange?: (detail) => void

Called when the form value changes through the user.

ChangeDetail

void


readonly optional onConfirm?: (detail) => void

Called when the gateway knows the postcode.

ConfirmDetail

void


readonly optional onError?: (detail) => void

Called when a request or the location fails, or for a secret key.

ErrorDetail

void


readonly optional required?: boolean

True when the form needs a postcode.

Unofficial. Not made or endorsed by NIPOST.