Astro
ActiveStatic-first with islands. Address widget as a hydrated island.
Install
npm i @postio/address-finder
30-second example
---
// src/pages/checkout.astro
const apiKey = import.meta.env.PUBLIC_POSTIO_KEY;
---
<input id="address-search" placeholder="Start typing an address…" />
<input id="line1" />
<input id="town" />
<input id="postcode" />
<script>
import { setup } from '@postio/address-finder';
setup({
apiKey: '{apiKey}',
input: '#address-search',
output: {
address_line_1: '#line1',
post_town: '#town',
postcode: '#postcode',
},
});
</script>