Skip to content

Split Contact Section with Form

Tailwind CSS contact section with a gradient info panel beside a validated contact form, topic chips, character counter and a simulated send state.

Also known as: contact section, contact us form with info panel, contact page layout, contact form with topics

Split Contact Section with Form live demo

Open in new tab

Tailwind CSS code (HTML, JS)

A split contact section built with Tailwind CSS: a violet-to-fuchsia info panel with email, phone and office address sits next to a clean contact form with topic chips, a character counter, inline validation and a simulated send state. It suits contact pages, agency sites and the closing section of a product landing page.

How it works

The root is section.tcs-contact. Inside, one rounded card uses a five-column grid from the lg breakpoint: the info panel spans two columns and the form spans three. On phones the panel stacks above the form.

The panel uses bg-linear-to-br from-violet-700 via-violet-600 to-fuchsia-600 with two decorative circles. Contact details are a dl: each dt is an icon tile with a visually hidden label (Email, Phone, Office) and each dd holds a mailto: or tel: link or an address element. A small pill with a pinging dot shows the expected reply time.

The form is form.tcs-form with novalidate. Required fields sit in wrappers marked data-tcs-field, each with a hidden error message marked data-tcs-error. The topic chips are visually hidden radio inputs using the peer class; their sibling span turns violet with peer-checked: and shows a ring with peer-focus-visible:.

The script runs on DOMContentLoaded for every .tcs-form. On submit it checks each field (non-empty, checkValidity() for the email, checked for the consent box), sets aria-invalid, shows the error and adds its id to aria-describedby, then focuses the first invalid field. After the first attempt, fields re-validate on input, change and blur. The data-tcs-count element tracks the maxlength of the message. A valid submit disables .tcs-submit, reveals .tcs-spinner, waits for data-tcs-delay milliseconds, resets the form and writes a success message into data-tcs-status.

Customization

  • The window.setTimeout in the submit handler of script.js: replace it with fetch() to your endpoint; a commented example shows new FormData(form).
  • data-tcs-delay on .tcs-form: change the simulated send time (default 1200 ms).
  • maxlength="500" on #tcs-message: the counter reads the new limit automatically.
  • from-violet-700 via-violet-600 to-fuchsia-600 on the panel and bg-violet-600 on .tcs-submit: switch to another palette such as from-sky-700 to-cyan-500.
  • lg:grid-cols-5 with lg:col-span-2 and lg:col-span-3: give the form more or less room.
  • Add or rename topic chips by copying a label with a peer sr-only radio and changing its value.

Use cases

  • Contact pages: an info panel with email, phone and office address sits beside the form
  • Agency sites: topic chips let visitors say what their message is about
  • Product landing pages: a closing contact section ends the page with a clear next step
  • Message forms: a character counter and inline validation guide the sender

Accessibility

Every input has a visible label, the chips are grouped in a fieldset with a legend, and radios stay keyboard operable with arrow keys. Errors are linked through aria-describedby only while they are visible, together with aria-invalid. The status line has role="status" and aria-live="polite", and the form sets aria-busy while sending. Contact icons are aria-hidden with sr-only labels. All controls show visible focus rings, and the spinner, ping and transitions stop under prefers-reduced-motion.

Usage notes

For several forms on one page, give each copy unique id values for inputs, errors and the counter.

Split Contact Section with Form at a glance

Framework
Tailwind CSS
Code
HTML, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Contact Sections
License
Free for personal and commercial use

Questions about this template

Can I use the Split Contact Section with Form 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 Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear 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):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Split Contact Section with Form – free Tailwind CSS contact section template
Split Contact Section with Form · free Tailwind CSS contact section template

More Contact Sections

Contact Section with Office Details – free WordPress contact section template

Contact Section with Office Details

A contact section with office details: address, phone, email and opening hours beside an office photo, with Call us and Get directions buttons for Gutenberg.

Office Locations with City Photos – free Bootstrap 5 contact section template

Office Locations with City Photos

Bootstrap 5 contact section with four office cards showing a city photo, address, phone, email, live local time, open/closed badge and directions link.

Contact Section with Details – free Bootstrap 5 contact section template

Contact Section with Details

Bootstrap 5 contact section with address, phone and email cards, copy buttons and a CSS map placeholder with opening hours.