Components · Reference
Authentication code input
Collect a six-digit one-time code.
Preview
Could not verify the code.
Usage
tsx
import { AuthCodeInput } from "@krak-stack/auth/auth-code-input/react";
export const VerificationField = ({
label,
error,
}: {
label: string;
error?: string;
}) => <AuthCodeInput name="code" label={label} error={error} />;
Place AuthCodeInput inside your form. The six slots submit one string under name, so leading zeroes are preserved. The field supports typing, pasting a code, and one-time-code autofill. It is required by default; set required to false to allow an empty field.
Verify the submitted code on the server. Pass a localized error to show a failure next to the field. In Effect UI, redact the value before putting it in a message; the form submit handler receives a plain string.
Installation
shell
bun add @krak-stack/auth