Skip to content

Contact Form with Map and Details

Dark Bootstrap 6 contact section with an OpenStreetMap embed, address, phone, email and live opening hours, plus a validated form and Toast confirmation.

Also known as: contact section with map, contact form with map, contact page with address, opening hours contact, location and contact section

Bootstrap 6 Contact Forms Responsive Dark #contact #dark #form #map #responsive

Contact Form with Map and Details live demo

Open in new tab

Bootstrap 6 code (HTML, CSS, JS)

A dark contact section for Bootstrap 6 that puts everything a visitor needs on one screen: a map of the office, the address, phone, email and opening hours on the left, and a short contact form on the right. It is a good fit for studios, agencies, shops and clinics that want people to either visit or write. A Bootstrap 6 Toast confirms the message after sending.

How it works

The root .cmd-root sets data-bs-theme="dark" and two columns from 992px up. The .cmd-map card stacks an OpenStreetMap <iframe class="cmd-map-frame"> on top of an inline SVG drawing (.cmd-map-fallback) with canals, streets and a pin. If the embed is slow, blocked or not rendered, the card still looks like a map. The "Get directions" button links to OpenStreetMap directions for the same coordinates.

The four .cmd-detail cards hold the contact details. The address card has a .cmd-copy button that copies data-cmd-copy with the Clipboard API; when that is blocked (for example in a sandboxed preview) it selects the address text instead. The hours list is a <dl class="cmd-hours"> whose rows carry data-cmd-days, data-cmd-open and data-cmd-close. On load the script marks today's row with .is-today and turns the .cmd-open badge into "Open now" (theme-success) or "Closed now" (theme-danger) based on the visitor's clock, so nothing is hard-coded to a date.

The form uses Bootstrap 6's data-bs-validate, so errors appear through :user-invalid with no validation code. The topic picker is a .btn-group of radio toggle buttons. On submit the script focuses the first invalid field; when everything is valid it shows a spinner, writes a topic-specific message into .cmd-toast-text, resets the form and calls Toast.getOrCreateInstance(...).show().

Customization

  • --cmd-accent and --cmd-accent-ink on .cmd-root: change the amber accent and the text on accent buttons; the scoped --bs-primary-* tokens follow.
  • --cmd-bg, --cmd-card and --cmd-line on .cmd-root: adjust the background, card surfaces and borders.
  • The bbox and marker values in the iframe src and the to= value in .cmd-directions: point the map at your own location.
  • data-cmd-days, data-cmd-open and data-cmd-close on each .cmd-hours row: set your opening hours (days 0–6, Sunday is 0; hours in 24h).
  • data-cmd-copy on .cmd-copy: the exact text copied to the clipboard.
  • Replace the setTimeout in the submit handler with a fetch() POST of new FormData(form).

Use cases

  • Local businesses: an embedded map, address, phone and email sit next to the form
  • Shops and restaurants: live opening hours show whether you are open right now
  • Service companies: a validated form with a toast confirmation replaces a separate contact page
  • Offices and clinics: visitors find the location and send a message in one section

Accessibility

The map iframe has a descriptive title, the decorative SVG is aria-hidden, and the address uses <address>. Phone and email are real tel: and mailto: links. Topic toggles are native radios inside a labelled group. Invalid fields get aria-invalid, and the Toast is a polite role="status" region. Focus rings use the accent color on the dark background.

Bootstrap 6 notes

Bootstrap 5's btn-check input plus label pair becomes one label.btn-check with the radio inside. Validation moves from .was-validated JavaScript to data-bs-validate, btn-primary is btn-solid theme-primary, badges use badge-subtle theme-*, and spinner-border-sm is spinner-sm. Toasts still need JavaScript to show. Built on Bootstrap 6.0.0-alpha.1, so APIs may still change.

Contact Form with Map and Details at a glance

Framework
Bootstrap 6
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 6, Bootstrap Icons
Layout
Responsive, works on mobile, dark design
Category
Contact Forms
License
Free for personal and commercial use

Questions about this template

Can I use the Contact Form with Map and Details code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 6 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/css/bootstrap.min.css">
  • <script type="module" src="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">

Built for Bootstrap 6.0.0-alpha.1. Bootstrap 6 ships as an ES module, so its script and this component's JavaScript load with type="module". Alpha releases can still change before the stable version.

Contact Form with Map and Details – free Bootstrap 6 contact form template
Contact Form with Map and Details · free Bootstrap 6 contact form template

More Contact Forms

Contact Form with Validation – free Bootstrap 6 contact form template

Contact Form with Validation

Bootstrap 6 contact form with floating labels, CSS-only validation via data-bs-validate, a character counter, consent check and a simulated send with success alert.

Contact Form Card – free Tailwind CSS contact form template

Contact Form Card

Tailwind CSS contact form card with a topic select, live character counter and meter, inline validation and a simulated sending state.

Contact Form with Validation – free Bootstrap 5 contact form template

Contact Form with Validation

Bootstrap 5 contact form with floating labels, client-side validation, a character counter, a success message and a contact details panel.