A shadcn-style pin input component built with Ark UI primitives.

Installation

npx shadcn@latest add @ark-cn/pin-input

Usage

import * as PinInput from "@/components/ui/pin-input"

Read exported parts in src/components/ui/pin-input.tsx and compose the primitive according to the Ark UI pattern for this component.

Examples

Separated

Grouped

Grouped 3-3

Grouped 1-4-1

Grouped pairs 2-2-2

Placeholder

Blur on complete

OTP autocomplete

Sets one-time-code autocomplete on fields.

Masked

Root provider

usePinInput + PinInputRootProvider - focus from outside.

With field

Field wires disabled/invalid/required into Ark Field context for the pin root.

Field invalid

Code does not match the expected pattern.

Controlled

Value: -

Invalid entry

Try a letter - onValueInvalid: -

Alphanumeric

Disabled

Read only

Context

Context: in progress - -

Four digits

API reference

This component mirrors the upstream Ark UI primitive.

See the ARK UI documentation for the full API.

Accessibility

See the Ark UI documentation for clarification.