Bootstrap 5 Contact Form
A Bootstrap 5 contact form is a structured HTML form component that collects user input — typically name, email, subject, and message — and submits it to a backend handler or third-party service. It uses Bootstrap's form control classes, grid layout, and validation utilities to produce an accessible, mobile-responsive form. Use it on any page where users need a direct channel to reach you: service pages, landing pages, support sections, or portfolio sites.
Primary Class
.contact-formCommon Use Cases
- →A freelance designer's portfolio site where prospective clients submit project enquiries including budget range and timeline
- →A SaaS product's support page where users report bugs or request features with a categorised subject dropdown
- →A local restaurant or venue website where customers ask about private hire, bookings, or dietary requirements
- →A B2B services company's 'Get a Quote' page that captures company name, role, and service interest before a sales call
Variants & Classes
| Variant | Description |
|---|---|
| Contact Form Default | Standard contact form with Bootstrap's default styling. |
| Contact Form Responsive | Responsive variant that adapts to different screen sizes. |
Code Example
<section class="py-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-7">
<h2 class="mb-1">Get in Touch</h2>
<p class="text-muted mb-4">We typically respond within one business day.</p>
<form novalidate>
<div class="row g-3">
<div class="col-sm-6">
<label for="contactName" class="form-label">Full Name</label>
<input type="text" class="form-control" id="contactName" placeholder="Jane Smith" required>
<div class="invalid-feedback">Please enter your full name.</div>
</div>
<div class="col-sm-6">
<label for="contactEmail" class="form-label">Email Address</label>
<input type="email" class="form-control" id="contactEmail" placeholder="[email protected]" required>
<div class="invalid-feedback">Please enter a valid email address.</div>
</div>
<div class="col-12">
<label for="contactSubject" class="form-label">Subject</label>
<select class="form-select" id="contactSubject" required>
<option value="" disabled selected>Select a topic</option>
<option value="general">General Enquiry</option>
<option value="support">Technical Support</option>
<option value="billing">Billing Question</option>
<option value="partnership">Partnership Opportunity</option>
</select>
<div class="invalid-feedback">Please select a subject.</div>
</div>
<div class="col-12">
<label for="contactMessage" class="form-label">Message</label>
<textarea class="form-control" id="contactMessage" rows="5" placeholder="Tell us how we can help..." required></textarea>
<div class="invalid-feedback">Please include a message.</div>
</div>
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="contactConsent" required>
<label class="form-check-label text-muted" for="contactConsent">
I agree to the <a href="/privacy">Privacy Policy</a> and consent to being contacted.
</label>
<div class="invalid-feedback">You must agree before submitting.</div>
</div>
</div>
<div class="col-12">
<button type="submit" class="btn btn-primary px-4">Send Message</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>Live Examples
Basic Contact Form
Canvas Framework Variants
The Canvas template extends Bootstrap 5 with 1,658+ component variants. Generate any of these using Canvas Builder:
- ✓Canvas Builder generated contact form with custom colours
- ✓Contact Form with interactive states
- ✓Responsive contact form for all screen sizes
Best Practices
Use novalidate + JavaScript for client-side validation
Add the `novalidate` attribute to your `<form>` tag and use Bootstrap's built-in validation styles by toggling the `was-validated` class on submit. This gives you full control over when error states appear rather than relying on inconsistent browser-native UI.
Limit fields to what you will actually act on
Every extra field reduces completion rates. If you only need name, email, and message to respond meaningfully, remove the subject dropdown — you can always ask follow-up questions once the conversation has started.
Pair textarea rows with a character counter
Set `rows="5"` on your `<textarea>` to communicate expected message length, and consider adding a lightweight JavaScript character counter beneath it using `form-text text-muted` — this reduces vague one-word submissions.
Include a consent checkbox for GDPR compliance
If your site serves EU users, a required `form-check` linking to your privacy policy is a legal requirement under GDPR Article 6. Bootstrap's validation states make it easy to block submission until the box is checked without custom CSS.