Officina UI
Components

PinInput

Segmented one-time-code input with one cell per character and a blinking caret.

PinInput renders a row of single-character cells for entering OTP and verification codes. It is controlled — value holds the full string and onChange fires as each character is typed or pasted. Set length for the number of cells (defaults to 6). Built on input-otp, it handles caret movement and paste across cells automatically.

Example

Preview
import { PinInput } from '@officina/ui';
import { useState } from 'react';

function Example() {
  const [code, setCode] = useState('');
  return <PinInput value={code} onChange={setCode} length={6} />;
}

API

PropTypeDefaultDescription
onChange*(value: string) => void—Called with the full code as digits are entered.
value*string—Current code value.
disabledboolean—
invalidboolean—Mark the field invalid for validation styling.
labelstringSecurity codeVisible label above the inputs.
lengthnumber6Number of input cells. Defaults to 6.
namestring—Form field name, for native form submission / form libraries.
requiredboolean—Marks the field as required for validation styling and `aria-required`.

On this page