Vue dynamic form

Build a dynamic, schema-driven form in Vue with no backend. Render the inputs from a fields array with v-for, so you add or reorder fields by editing data. It posts once to Formpaste. Copy the component and add your access key.

How to build it

  1. Create a form in your Formpaste dashboard and copy its access key.
  2. Copy the schema-driven component below and edit the fields array to your form.
  3. Replace YOUR_ACCESS_KEY_HERE with your access key, then deploy.

Prompt for your AI coding agent

Add a Formpaste dynamic form to my Vue 3 app. Use a single-file component that renders inputs from a fields array with v-for, binds each with v-model into a reactive object, and POSTs once as application/x-www-form-urlencoded (URLSearchParams) to https://api.formpaste.com/submit with a hidden access_key. The fields should come from a schema, not hardcoded markup.

Or connect the Formpaste MCP server to Claude Code, Codex, Cursor, Claude Desktop, VS Code, or any mcp-remote client. See the setup guide.

Vue gotchas

A Vue contact form is a single-file component with v-model bindings and an @submit.prevent handler that POSTs to Formpaste. There is no backend and no API of your own. Put the fetch in the component and you are done.

It is a normal component

The form lives in a .vue single-file component with a <script setup> block. Bind the fields with v-model or read a FormData off the form element on submit, then post to the Formpaste endpoint. No store or plugin is required for a simple form.

No API of your own

You do not proxy through your own server. The component posts straight to the Formpaste endpoint, which removes a mailer and a submissions store you would otherwise build.

Handle the response in a ref

The endpoint returns JSON (success, message, id). Await the fetch and set a status ref to show your own success or error state, or set a redirect URL in the dashboard and skip the client handling.

Composition or Options API, both work

The examples use <script setup> and the Composition API, but the same fetch works in an Options API component. Formpaste only cares about the POST, not how you structure the component.

What to get right

The fields come from a schema, not the markup

A dynamic form renders its inputs from an array of field definitions, so you add or reorder fields by editing data, not JSX or template markup. The same component handles any field-set.

One submit for any shape

However many fields the schema has, the form posts once to Formpaste as a single submission. Keep the hidden access_key input in the payload and the field names meaningful so your inbox is readable.

Keep field names stable

The field name is what shows up in your inbox and exports, so name each schema entry clearly (name, email, message) even as you change labels or order. Formpaste stores whatever names you send.

How it works

Three simple steps for form submissions to land in your email inbox.
Create your form, set your form's action URL to Formpaste's endpoint, and add your access key.

1

Create your form

Sign up, verify your email, and create an access key in your dashboard.

2

Copy the code

Paste the snippet above into your project. Pick CSS or Tailwind to match your site.

<script setup lang="ts">
import { reactive } from "vue";

const ENDPOINT = "https://api.formpaste.com/submit";

const fields = [
  { name: "name", type: "text", label: "Name" },
  { name: "email", type: "email", label: "Email" },
  { name: "message", type: "textarea", label: "Message" },
];

const data = reactive<Record<string, string>>(
  Object.fromEntries(fields.map((f) => [f.name, ""]))
);

async function submit() {
  const body = new URLSearchParams({ access_key: "YOUR_ACCESS_KEY_HERE", ...data });
  await fetch(ENDPOINT, { method: "POST", body });
}
</script>

<template>
  <form @submit.prevent="submit">
    <label v-for="f in fields" :key="f.name">
      {{ f.label }}
      <textarea v-if="f.type === 'textarea'" v-model="data[f.name]" />
      <input v-else :type="f.type" v-model="data[f.name]" />
    </label>
    <button type="submit">Send</button>
  </form>
</template>
3

Add your access key

Replace the placeholder with your access key to start receiving submissions.

<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY_HERE">

Vue dynamic form FAQ

Paste a form. Get submissions.

Instantly without setting up any backend, servers or databases. 250 submissions/mo free - no credit card.

Other Vue forms