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…

Archive contents

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

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

Tags

Updated on October 16, 2026.

In the same spirit

  • A keyboard-filterable dropdown to pick one or several values, shown as chips, backed by a real select field.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A short form for tradespeople: type of job, description, postcode, timeframe, optional photos, then a confirmation summary.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An appointment form: reason, day with the native date picker, morning and afternoon slots as radio buttons, full slots crossed out and a summary of the choice.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component