Skip to content

One-time code input

Six boxes for the code received by email or text: automatic move to the next box, whole-code paste, arrow keys and backspace.

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

Description

Each typed digit moves the cursor forward, backspace on an empty box goes back to the previous one, arrows, Home and End move focus. A pasted code, or one suggested by the phone keyboard (autocomplete one-time-code), spreads itself across the six boxes, keeping digits only. An incomplete code shows a message linked to the boxes with aria-describedby and focuses the first empty box. The "Resend code" link waits 30 seconds, stays keyboard reachable (aria-disabled) and the delay is read to screen readers. The form submits normally, or through your own code via the ccv:submit, ccv:resend and ccv:error events. Without JavaScript a single six-digit field takes over. No dependency, about 130 lines of script, light and dark themes, usable from 360 px, transitions off with prefers-reduced-motion.

Code

Loading the code…

The code of this component in

Archive contents

champ-code-verification-html-tailwind.zip3 files · 7 Ko

  • index.html15 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