PostcodeFieldProps
The props of PostcodeField. Each one sets the attribute of the same name on the element,
and spec/field.md defines each one.
Properties
Section titled “Properties”apiKey?
Section titled “apiKey?”
readonlyoptionalapiKey?:string
A publishable key. Without a key, the field sends no request.
baseUrl?
Section titled “baseUrl?”
readonlyoptionalbaseUrl?:string
The gateway’s address. The default is NIPOST’s gateway.
confirm?
Section titled “confirm?”
readonlyoptionalconfirm?:"none"|"level1"|"level2"
The lookup level of the check: none, level1 or level2. The default is level1.
defaultValue?
Section titled “defaultValue?”
readonlyoptionaldefaultValue?:string
The text in the input at first. The user changes it from then on.
disabled?
Section titled “disabled?”
readonlyoptionaldisabled?:boolean
True turns the field off, and the form leaves it out.
readonlyoptionalgps?:boolean
True shows the location button, when the field has a key.
label?
Section titled “label?”
readonlyoptionallabel?:string
The visible label. The default is Postcode.
legacy?
Section titled “legacy?”
readonlyoptionallegacy?:"accept"|"reject"
Whether an old 6-digit postcode is a form value. The default is accept.
messages?
Section titled “messages?”
readonlyoptionalmessages?:Partial<Readonly<Record<MessageKey,string>>>
Messages that replace the English ones, by key.
readonlyoptionalname?:string
The name of the form value.
onChange?
Section titled “onChange?”
readonlyoptionalonChange?: (detail) =>void
Called when the form value changes through the user.
Parameters
Section titled “Parameters”detail
Section titled “detail”ChangeDetail
Returns
Section titled “Returns”void
onConfirm?
Section titled “onConfirm?”
readonlyoptionalonConfirm?: (detail) =>void
Called when the gateway knows the postcode.
Parameters
Section titled “Parameters”detail
Section titled “detail”ConfirmDetail
Returns
Section titled “Returns”void
onError?
Section titled “onError?”
readonlyoptionalonError?: (detail) =>void
Called when a request or the location fails, or for a secret key.
Parameters
Section titled “Parameters”detail
Section titled “detail”ErrorDetail
Returns
Section titled “Returns”void
required?
Section titled “required?”
readonlyoptionalrequired?:boolean
True when the form needs a postcode.
Unofficial. Not made or endorsed by NIPOST.