A JavaScript form, no framework needed
Plain JavaScript, Svelte, Angular or Astro: one function builds the form in your page, with your CSS classes, texts and redirects.
In three steps
-
Step 1 : Install the SDK (npm install @canardform/sdk) or load it from a CDN.
-
Step 2 : Call mountForm on an element of the page with your form’s id.
-
Step 3 : Adjust with the options: classes, messages, onSubmitted, beforeSubmit.
import { mountForm } from '@canardform/sdk';
await mountForm('#form', 'YOUR_FORM', {
classes: { form: 'grid gap-4', submit: 'btn btn-primary' },
onSubmitted: () => (window.location.href = '/thanks'),
});
What you gain
- No framework dependency: one function, one page element.
- createFormController to render everything yourself: state, validation, steps and submission with no imposed HTML.
- Hidden fields filled from the page address (UTM source, campaign), beforeSubmit for the rest.
- Steps, conditions, files and bot check handled.
Frequently asked questions
With Svelte, Angular or Astro, where do I call mountForm?
In code that runs in the browser, once the element is on the page: onMount in Svelte, ngAfterViewInit in Angular, a client script in Astro. mountForm builds DOM and refuses to run on the server.
Can I write all the HTML myself?
Yes. createFormController, imported from @canardform/sdk/controller, provides state, validation, steps, conditions and submission without rendering anything: you keep full control of the markup.
How do I save where a visit came from (UTM, campaign)?
Add a hidden field to the form: it reads the page address parameter on its own, for example ?utm_source=newsletter. Keep beforeSubmit for a value only your site knows.
Your first form is 5 minutes away.
Free to start. Change plans only when you need to.