Skip to content
  • No data uploaded
  • Instant results

Tailwind CSS Contact Form for Vue 3

A production-ready minimal contact form: a contact card with name, email, a topic selector, a message textarea and a submit button. Pick your brand color, toggle dark mode and corner radius — the live preview and the Vue 3 code update instantly in your browser.

Live component editor

Library
Framework
Style
Theme
Corner radius
Live preview
<template>
  <div class="w-full max-w-lg p-8 bg-white border border-slate-200 shadow-sm rounded-xl">
    <h2 class="text-2xl font-bold text-slate-900">Get in touch</h2>
    <p class="mt-1 mb-6 text-sm text-slate-500">We usually reply within one business day.</p>
    <form class="flex flex-col gap-4">
      <div class="grid grid-cols-1 md:grid-cols-2 gap-3">
        <div>
          <label for="cf-name" class="block mb-1.5 text-sm font-medium text-slate-700">Name</label>
          <input id="cf-name" type="text" autocomplete="name" class="block w-full px-3 py-2 text-sm rounded-lg border bg-white border-slate-300 text-slate-900 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#4f46e5] focus:border-[#4f46e5]" required>
        </div>
        <div>
          <label for="cf-email" class="block mb-1.5 text-sm font-medium text-slate-700">Email</label>
          <input id="cf-email" type="email" autocomplete="email" class="block w-full px-3 py-2 text-sm rounded-lg border bg-white border-slate-300 text-slate-900 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#4f46e5] focus:border-[#4f46e5]" required>
        </div>
      </div>
      <div>
        <label for="cf-topic" class="block mb-1.5 text-sm font-medium text-slate-700">Topic</label>
        <select id="cf-topic" class="block w-full px-3 py-2 text-sm rounded-lg border bg-white border-slate-300 text-slate-900 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#4f46e5] focus:border-[#4f46e5]">
          <option>General question</option>
          <option>Sales</option>
          <option>Support</option>
        </select>
      </div>
      <div>
        <label for="cf-message" class="block mb-1.5 text-sm font-medium text-slate-700">Message</label>
        <textarea id="cf-message" rows="4" class="block w-full px-3 py-2 text-sm rounded-lg border bg-white border-slate-300 text-slate-900 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#4f46e5] focus:border-[#4f46e5]" placeholder="How can we help?" required></textarea>
      </div>
      <button type="submit" class="inline-flex items-center justify-center px-4 py-2.5 text-sm font-semibold rounded-lg bg-[#4f46e5] hover:bg-[#433cc3] text-white shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-[#4f46e5] focus:ring-offset-2 focus:ring-offset-white">Send message</button>
    </form>
  </div>
</template>
All components →

Free Tailwind CSS Contact Form for Vue 3 by pGento

Install Tailwind CSS for Vue 3

Create a Vue 3 project with Vite, then add Tailwind CSS v3:

npm create vite@latest my-app -- --template vue
cd my-app
npm install
npm install -D tailwindcss@3 postcss autoprefixer
npx tailwindcss init -p

Set content: ['./index.html', './src/**/*.{vue,js}'] in tailwind.config.js, and add to src/style.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

The brand color is applied with arbitrary values such as bg-[#4f46e5], so no theme configuration is needed.

Use the contact form in Vue 3

<!-- App.vue -->
<script setup>
import ContactForm from './ContactForm.vue';
</script>

<template>
  <ContactForm />
</template>

Accessibility & customization

All controls have explicit labels, the <select> has a meaningful default option, and required fields use the native required attribute for built-in validation messages.

Every color, radius and dark-mode choice is baked into plain utility classes, so the copied code has no runtime dependency on this site.

Compatibility

ItemDetails
CSS frameworkTailwind CSS v3.4+
LibraryVue 3 (<script setup>)
Interactive stateNone (static markup)
Dark modeYes — toggle in the editor
StyleMinimal

Frequently asked questions

How do I install this Tailwind contact form in Vue 3?
Create a Vue 3 project, install Tailwind CSS as shown in the installation section, then paste the generated code.
Can I change the color of the contact form?
Yes. Use the brand color picker or type any hex code — the preview and code update instantly, and the color is written directly into the classes you copy.
Does the contact form support dark mode?
Yes. Toggle “Dark mode” in the editor to generate a dark palette version of the same component.
Is the contact form accessible?
All controls have explicit labels, the <select> has a meaningful default option, and required fields use the native required attribute for built-in validation messages.
Is this component free for commercial use?
Yes. The generated code is yours to use in personal and commercial projects without attribution.
Tailwind CSS Contact Form for Vue 3

Embed this tool on your site

Paste this code into any web page. It stays free, fast and ad-free inside your site.

Print or save as PDF

Prints just this tool and its result. Choose “Save as PDF” as the printer to get a file. Branding is stored only in this browser.