Verify code

A six-digit one-time code, grouped in threes, with a resend action for the email that never arrived.

Verify code
Default density Compact density Restart from the initial state Show the copyable source

Check your email

We sent a 6-digit code to ada@example.com.

Resend code Verify
<form style="inline-size:min(100%, 24rem)"> <tp-card> <h2 slot="header">Check your email</h2> <p slot="description">We sent a 6-digit code to ada@example.com.</p> <tp-field label="Verification code"> <tp-one-time-code-field length="6" name="code" group-lengths="[3,3]"></tp-one-time-code-field> </tp-field> <tp-button slot="footer" variant="ghost">Resend code</tp-button> <tp-button slot="footer" type="submit">Verify</tp-button> </tp-card> </form>

How it’s composed

  • One-time code field handles paste, autofill from the operating system and moving between cells; group-lengths splits the six digits into two groups of three, which is easier to read back.
  • Field names the code for assistive technology; the visible cells stay unlabeled.
  • Button puts the secondary resend before the primary verify, in reading order.

Make it yours

Submit automatically when the last digit is entered, and start a cooldown on the resend action after it is used.

More patterns