While Postcode Lookup can reduce much of the friction by rendering postcode lookup elements inside the provided
context, this is less ideal for forms with complex designs and styling rules. In these instances, you may create one or more custom postcode lookup elements and provide them to Postcode Lookup.
Postcode Lookup consists of 5 main elements with the following order and hierarchy:
- Text Input
- Dropdown Container
- Message Container
- Text Input
Identify custom elements to Postcode Lookup by supplying CSS Selectors or node references to your DOM elements. When a custom element is specified, the corresponding element will no longer be rendered in
context. Listed below are elements of Postcode Lookup which can be supplied to the plugin:
Postcode Lookup Input Field
Identify an alternate element to use as the Postcode Lookup field.
Identify an alternate element to trigger a postcode lookup.
Identify an alternate text element to convey messages to the user.
Address Dropdown Container
Identify an alternate element and location to render the address selection dropdown.
Our WooCommerce plugin takes such an approach to to styling the Postcode Lookup UI to conform with the WooCommerce checkout. Our plugin creates an input, button and select container in with the same WooCommerce conventions and leaves the context to manage the message box. See the plugin code here