Ask Natuna

Ask about the design system

Hi, I am Natuna.

Ask me about the design system: components, tokens, statuses, and how to use them.

Natuna can be wrong. The docs are the source of truth.

Skip to content
  • IntroductionPage
  • Ask NatunaAsk about the design systemPage
  • FoundationColor, type, number, effectPage
  • Components overviewPage
  • ThemesLight and dark modePage
  • NamingProperty and page namesPage
  • Privacy statementPage
  • Text-safe stepsFirst AA and AAA step per color rampSection
  • AccessibilityWCAG 2.2 AAA rulesSection
  • Dark modeThemesSection
  • Using it todayFigma file and React codeSection
  • Component statusDesign status and In ReactSection

Arrow keys to move, Enter to open, Esc to close.

OTP Input

Boxes for entering a one-time code sent by SMS or email.

Status
ReadyBuild day 19 of 21
Code
In React
Role
Form

Usage

This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.

Verification code

Try 482719. Resend code in 00:45

Pastes as editable layers. Shadows are not exported.

import { useState } from "react";
import { OtpInput } from "@/ui";

export default function OtpDemo() {
  const [code, setCode] = useState<string>("");

  return (
    <OtpInput
      label="Verification code"
      value={code}
      onChange={setCode}
      onComplete={(v: string) => console.log("submit", v)}
      hint="Resend code in 00:45"
    />
  );
}

Variants and states

Every specimen is the real component from src/ui, held in one state.

size smempty, filled, error, disabled
Code
Code
Code

Incorrect OTP. 2 attempts left.

Code
size mdempty, filled, error, disabled
Code
Code
Code

Incorrect OTP. 2 attempts left.

Code
size lgempty, filled, error, disabled
Code
Code
Code

Incorrect OTP. 2 attempts left.

Code

Pastes as editable layers. Shadows are not exported.

Props

label
string · default none
Required. Names the group.
length
4 | 6 · default 6
Number of boxes.
value, onChange
string, (value) => void · default none
Digits only.
onComplete
(value) => void · default none
Called once every box is filled. Use it to submit.
size
"sm" | "md" | "lg" · default "md"
hint, error
string · default none
Helper or error line.
disabled
boolean · default none

Figma to code

Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.

🔀 Count
length
4 or 6 Digit.
📐 Size
size
OTP Cell size.
🎯 State
value, error, disabled
Focused is the browser.
Show Helper Text, Helper Text
hint
Pass to show.

Accessibility

What the code in src/ui does today, and what it leaves to you.

Keyboard

  • Typing moves to the next box, Backspace goes back, arrows move, and pasting a code fills every box.

Screen readers

  • A group named by the label. Each box is named Digit 1 of 6 and so on. The first box has autocomplete=one-time-code.

What you still need to do

  • Tell people how long until they can resend, and do not clear the boxes on error without saying so.

When to use

Verification steps. Accept a pasted code and move focus between boxes automatically.

Do and don't

Do

  • Set autocomplete="one-time-code" so phones can fill it.
  • Show where the code was sent and a way to resend it.

Don't

  • Block paste.
  • Clear the whole code when one digit is wrong.

4 of 16 other atoms, same role and ready ones first.

See all components

Status reflects the component tracker snapshot of 29 October 2026.