Skip to content

Astro

This site is Astro, and every form on it is the live product.

src/pages/contact.astro
---
const form = import.meta.env.PUBLIC_FORM_ID;
---
<formbuilder-form form={form}></formbuilder-form>
<script is:inline type="module" src="https://forms.justinjongstra.nl/formbuilder/asset/element.js"></script>

Because it is a custom element rather than a component, it works the same inside any framework Astro renders. All three below are real islands on this page, each with its own listener for fb:success.

src/components/ContactForm.vue
<script setup lang="ts">
import { onMounted, useTemplateRef } from 'vue';
defineProps<{ form: string }>();
const host = useTemplateRef<HTMLElement>('host');
onMounted(() => host.value?.addEventListener('fb:success', () => {
// your analytics call here
}));
</script>
<template>
<div ref="host"><formbuilder-form :form="form" /></div>
</template>

Vue passes unknown elements straight through, so no isCustomElement config, no wrapper package.

This page is Starlight, so the same applies: put the tag in an .mdx file or a component, add the script once with is:inline, and the form renders inside the prose.