Skip to content

Newsletter sign-up form

An e-mail field and its button on one line, a GDPR consent checkbox, clear errors, a typo suggestion and a confirmation message.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

Visitors type their address and tick a consent checkbox that is never pre-ticked, with a note on how the address is used, how to unsubscribe and a link to the privacy policy, as the GDPR requires. The address is checked when leaving the field, never while typing; a common domain typo (gmial.com, hotmail.fe…) triggers a one-click correction. On submit, each error appears under its field and focus moves to the first field to fix; once the form is valid, a message asks to confirm the subscription (double opt-in). Accessibility: everything works with the keyboard, each message is tied to its field through aria-describedby and aria-invalid, the suggestion is announced by a live region, focus moves to the confirmation, contrast exceeds 4.5:1 in light and dark modes and the animation stops with prefers-reduced-motion. Plug submission into your mailing service: nwl:subscribe event in HTML, onSubscribe prop in React.

Code

Loading the code…

The code of this component in

Archive contents

formulaire-newsletter-inline-html-tailwind.zip3 files · 7 Ko

  • index.html13 Ko
  • README.md4 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • A recruitment form for small businesses: target position, introduction, CV checked in the browser and GDPR consent, with inline errors.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A quote request form whose labels, hints and error messages are full French sentences, still readable at 320 px: nothing overflows, nothing is cut off, and each error is tied to its field.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Visitors pick a package and tick options: the pre-tax total, VAT and total including tax update live, and the summary is sent with the contact form.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A short NPS survey: a 0 to 10 score as radio buttons, then a follow-up question adapted to whether the customer is a detractor, passive or promoter.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component