Code Entry
A verification card with one box per character: typing, deleting, arrows and paste move between boxes, a blinking caret marks the active one, and busy, error and success states play on the row.
pixikit.com/docs/blocks/auth/code-entry
Customize
Length6
Group3
Kind
Resend wait30s
Auto submit
Props
17| Name | Type | Default | Description |
|---|---|---|---|
heading | string | "Check your inbox" | The heading of the card. |
text | string | "Enter the 6 digit code we sent you." | The line under the heading. |
length | number | 6 | How many characters the code has. |
group | number | 3 | Boxes per visual group, with a small dash between groups; 0 for no grouping. |
kind | "digits" | "letters" | "digits" | Whether the code is made of digits or letters. |
submitLabel | string | "Verify" | The label of the submit button. |
resendLabel | string | "Send a new code" | The label of the resend button. |
resendWait | number | 30 | Seconds before a new code can be asked for. |
waitLabel | string | "New code in {s}s" | The resend label while counting; `{s}` is the seconds left. |
errorText | string | "That code did not match" | The text shown when the code did not match. |
successText | string | "Verified" | The text shown when the code matched. |
backLink | { label: string; href: string } | null | { label: "Use another way", href: "#" } | A link under the card; null hides it. |
autoSubmit | boolean | true | Submit as soon as the last box is filled. |
labels | Partial<CodeEntryLabels> | None | Every other announced string. |
onComplete | (code: string) => boolean | void | Promise<boolean | void> | None | Called with the code; false or a rejection shows the error, anything else shows success. |
onResend | () => void | None | Called when the resend button is pressed. |
className | string | None |