Skip to content
  • No data uploaded
  • Instant results

Bootstrap 5 Contact Form for React

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 React code update instantly in your browser.

Live component editor

Library
Framework
Style
Theme
Corner radius
Live preview
import 'bootstrap/dist/css/bootstrap.min.css';
import './theme.css';

export default function ContactForm() {
  return (
    <div className="w-100 mw-lg p-5 bg-body border shadow-sm rounded-3">
      <h2 className="fs-4 fw-bold text-body-emphasis">Get in touch</h2>
      <p className="mt-1 mb-4 small text-body-secondary">We usually reply within one business day.</p>
      <form className="d-flex flex-column gap-3">
        <div className="row row-cols-1 row-cols-md-2 g-2">
          <div className="col">
            <label htmlFor="cf-name" className="form-label small fw-medium">Name</label>
            <input id="cf-name" type="text" autoComplete="name" className="form-control rounded-2" required />
          </div>
          <div className="col">
            <label htmlFor="cf-email" className="form-label small fw-medium">Email</label>
            <input id="cf-email" type="email" autoComplete="email" className="form-control rounded-2" required />
          </div>
        </div>
        <div>
          <label htmlFor="cf-topic" className="form-label small fw-medium">Topic</label>
          <select id="cf-topic" className="form-control rounded-2">
            <option>General question</option>
            <option>Sales</option>
            <option>Support</option>
          </select>
        </div>
        <div>
          <label htmlFor="cf-message" className="form-label small fw-medium">Message</label>
          <textarea id="cf-message" rows="4" className="form-control rounded-2" placeholder="How can we help?" required></textarea>
        </div>
        <button type="submit" className="btn btn-brand fw-semibold rounded-2">Send message</button>
      </form>
    </div>
  );
}
All components →

Free Bootstrap 5 Contact Form for React by pGento

Install Bootstrap 5 for React

Create a React project with Vite and install Bootstrap:

npm create vite@latest my-app -- --template react
cd my-app
npm install
npm install bootstrap

Save the generated theme.css next to the component; the component file already imports bootstrap/dist/css/bootstrap.min.css and ./theme.css. No Bootstrap JavaScript is required — interactivity uses useState.

Use the contact form in React

// App.jsx
import ContactForm from './ContactForm';

export default function App() {
  return <ContactForm />;
}

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 Bootstrap classes plus a tiny CSS-variable theme file, so the copied code has no runtime dependency on this site.

Compatibility

ItemDetails
CSS frameworkBootstrap 5.3+ (CSS only)
LibraryReact 18+ (function component)
Interactive stateNone (static markup)
Dark modeYes — toggle in the editor
StyleMinimal

Frequently asked questions

How do I install this Bootstrap contact form in React?
Create a React project, install Bootstrap 5 as shown in the installation section, then paste the generated code. Also save the generated theme.css file.
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.
Bootstrap 5 Contact Form for React

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.