Skip to content

Vue 3 Starter Kit

The Vue starter kit (@flowformhq/vue-starter) is a Vite + Vue 3 + TypeScript + Tailwind CSS project that renders FlowForm schemas using the Composition API.

Quick Start

bash
# Clone the kit
cd starter-kits/vue

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env: set VITE_FLOWFORM_URL and VITE_FLOWFORM_TOKEN

# Start dev server
npm run dev

Project Structure

src/
  lib/flowform.ts          # Zero-dependency TypeScript SDK
  composables/useFlowForm.ts  # Vue composable: reactive form state
  components/
    FieldRenderer.vue      # Field type rendering with v-model
    FormRenderer.vue       # Multi-step form with progress bar
    FormList.vue           # Browse active forms

Architecture

The kit follows the same server-authoritative rendering contract as the React kit:

  1. Schema fetchGET /api/v1/forms/{uuid}/schema
  2. Submission creationPOST /api/v1/submissions
  3. Value upsertPOST /api/v1/submissions/{uuid}/values
  4. Step navigationadvance / retreat
  5. Condition refreshGET /api/v1/submissions/{uuid}/conditions
  6. SubmitPATCH /api/v1/submissions/{uuid}

Key Differences from React Kit

AspectVueReact
Stateref() + computed()useState + useMemo
Two-way bindingv-model / update:modelValuevalue + onChange props
ReactivityAutomatic dependency trackingManual useCallback + useEffect
Routingvue-routerreact-router-dom
Form submitButton @click handlers<form onSubmit>
Error handlingInline error refErrorBoundary class component

Customizing

Styling

All components use Tailwind CSS. Edit src/style.css or override classes in .vue SFC templates.

Adding field types

Edit src/components/FieldRenderer.vue and add a new v-else-if branch:

vue
<div v-else-if="field.field_type.component === 'phone-input'">
  <label :for="field.code" class="block text-sm font-medium text-gray-700">
    {{ field.label }}
  </label>
  <input :id="field.code" type="tel" class="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2" />
</div>

Environment variables

VariableDescription
VITE_FLOWFORM_URLBase URL of your FlowForm API
VITE_FLOWFORM_TOKENAPI token for authenticated endpoints

Publishing

bash
npm run build

Outputs to dist/. The kit is published to npm as @flowformhq/vue-starter.

Licensed under CC BY 4.0.