Vue.js Newsletter Signup Form Generator
Grow your email list with a newsletter signup form
Form Preview
Vue.js Code
<template>
  <div class="form-container">
    <form @submit.prevent="handleSubmit">
      <div class="form-group">
        <label for="name">First Name</label>
        <input
          type="text"
          id="name"
          v-model="formData.name"
          
        />
      </div>
      <div class="form-group">
        <label for="email" class="required">Email Address</label>
        <input
          type="email"
          id="email"
          v-model="formData.email"
          required
        />
      </div>
      <div class="form-group">
        <label for="interests">Interests</label>
        <div class="checkbox-group">
          <div class="checkbox-item">
            <input
              type="checkbox"
              id="interests-0"
              v-model="formData.interests"
              :value="News"
            />
            <label for="interests-0">News</label>
          </div>
          <div class="checkbox-item">
            <input
              type="checkbox"
              id="interests-1"
              v-model="formData.interests"
              :value="Updates"
            />
            <label for="interests-1">Updates</label>
          </div>
          <div class="checkbox-item">
            <input
              type="checkbox"
              id="interests-2"
              v-model="formData.interests"
              :value="Promotions"
            />
            <label for="interests-2">Promotions</label>
          </div>
          <div class="checkbox-item">
            <input
              type="checkbox"
              id="interests-3"
              v-model="formData.interests"
              :value="Events"
            />
            <label for="interests-3">Events</label>
          </div>
        </div>
      </div>
      <div class="form-group">
        <label for="consent" class="required">I agree to receive newsletters</label>
        <div class="checkbox-item">
          <input
            type="checkbox"
            id="consent"
            v-model="formData.consent"
            required
          />
          <label for="consent">Yes</label>
        </div>
      </div>
      <div class="form-group">
        <button type="submit">Submit</button>
      </div>
    </form>
  </div>
</template>
<script>
export default {
  name: 'NewsletterSignupForm',
  data() {
    return {
      formData: {
        name: '',
        email: '',
        interests: [],
        consent: false,
      }
    };
  },
  methods: {
    handleSubmit() {
      console.log('Form submitted with data:', this.formData);
      // You would typically send this data to an API here
      alert('Form submitted successfully!');
    }
  }
};
</script>
<style scoped>
.form-container {
  max-width: 600px;
  margin: 0 auto;
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.form-group {
  margin-bottom: 15px;
}
label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}
.required:after {
  content: " *";
  color: red;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 16px;
}
textarea {
  height: 100px;
}
.checkbox-group, .radio-group {
  margin-bottom: 10px;
}
.checkbox-item, .radio-item {
  margin-bottom: 5px;
}
button {
  background-color: #4CAF50;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}
button:hover {
  background-color: #45a049;
}
</style>
Installation
How to setup Vue.js Newsletter Signup form
- 1Sign up to parrotforms.comCreate your first form API endpoint then copy your endpoint. Screenshot Placeholder
- 2Copy the example codeUse the copy button above to copy the entire code snippet. Screenshot Placeholder
- 3Paste the code and update the endpointReplace the form API endpoint with the one you got in step 1. Screenshot Placeholder
- 4Collect submissionsView and manage all form submissions in your parrotForms dashboard. Screenshot Placeholder
Need more advanced forms?
Create a free parrotForms account to access more templates, save your forms, and collect submissions.
Create a Free Account