JavaScript SDK for Formstork. Your forms, delivered.
Framework-free. Turn any HTML form into a working contact form, no server, no backend code.
npm install @formstork/jsimport { formstork } from "@formstork/js";
const form = document.querySelector("#contact");
formstork(form, {
accessKey: "YOUR_ACCESS_KEY", // get one at https://app.formstork.com
onSuccess: () => alert("Thanks, your message was sent."),
onError: (message) => alert(message),
});formstork(form, options) attaches a submit handler that collects the form fields and posts them. It returns a cleanup function that removes the handler.
While submitting it sets data-formstork-state on the form to submitting, success, or error, so you can style states in CSS.
import { submitToFormstork } from "@formstork/js";
const res = await submitToFormstork("YOUR_ACCESS_KEY", {
email: "ada@example.com",
message: "Loved the demo.",
});MIT · formstork.com