Request Reset Email
Step one of a reset: an email field and a submit that mails a recovery link.
3 個のフレームワーク初級
A single numeric field for the emailed 6-digit code, with a resend action.
<!--
A single field for the code, not six boxes: one input with inputmode="numeric"
and autocomplete="one-time-code" is what lets iOS and Android offer the SMS
code from the keyboard, and it stays a real labelled field for a screen reader.
The wide tracking just makes the digits read like separate cells.
-->
<div class="mx-auto w-full max-w-sm rounded-2xl border border-gray-200 bg-white p-6 shadow-sm sm:p-8 dark:border-gray-800 dark:bg-gray-950">
<h1 class="text-xl font-bold tracking-tight text-gray-900 dark:text-gray-100">Enter the code</h1>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">We sent a 6-digit code to your email.</p>
<form class="mt-6 space-y-4" action="#" method="post">
<div>
<label for="rp-code" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Verification code</label>
<input
id="rp-code"
name="code"
type="text"
inputmode="numeric"
pattern="[0-9]*"
autocomplete="one-time-code"
maxlength="6"
required
placeholder="------"
class="mt-1.5 w-full rounded-lg border border-gray-300 bg-white px-3.5 py-2.5 text-center text-lg font-semibold tracking-[0.5em] text-gray-900 placeholder:tracking-[0.5em] placeholder:text-gray-400 focus-visible:border-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:placeholder:text-gray-500 dark:focus-visible:ring-blue-400"
/>
</div>
<button type="submit" class="w-full rounded-lg bg-blue-600 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-blue-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 focus-visible:ring-offset-white motion-reduce:transition-none dark:focus-visible:ring-blue-400 dark:focus-visible:ring-offset-gray-950">
Verify code
</button>
</form>
<p class="mt-6 text-center text-sm text-gray-600 dark:text-gray-400">
Didn't get it?
<button type="button" class="font-medium text-blue-600 hover:text-blue-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 dark:text-blue-400 dark:focus-visible:ring-blue-400">Resend</button>
</p>
</div>| Prop | 型 | デフォルト | 説明 |
|---|---|---|---|
title | string | 'Enter the code' | カードの見出しテキスト。 |
email | string | - | ログイン中のアカウントのメールアドレス。 |
length | number | 6 | Length |
submitLabel | string | 'Verify code' | Submit label |
onSubmit | (data: { code: string }) => void | - | 送信時にフォームの値とともに呼ばれます。 |
onResend | () => void | - | On resend |
className | string | - | ルート要素にマージされる追加クラス。 |
One input with `inputMode="numeric"` and `autocomplete="one-time-code"` is what lets iOS and Android surface the SMS/email code from the keyboard, and it stays a real labelled field - the wide tracking just makes the digits read like separate cells. `length` sets the digit count and `onResend` fires a new code.