Skip to content

Pin Input ​

Accessible one-time-password input (shadcn InputOTP look). One hidden text field captures typing and paste; the slots show the characters and a blinking caret.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

Groups, mask & pattern ​

Slots shrink (36 → 28vp) when space is tight.

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SPinInput ​

shadcn InputOTP look (shadcn-vue PinInput): joined h-9 w-9 slots with a shared border, the active slot gets border-ring ring-ring/50 ring-[3px] and a blinking caret.

One transparent TextInput laid over the slots captures typing / paste / backspace (tapping anywhere opens the keyboard); the slots only render the characters. Slots shrink from 36 to 28vp when the component's own width is too small.

PropTypeDefaultDescription
lengthnumber6
value!!string | undefinedundefinedControlled value (use with !!). Leave undefined for uncontrolled.
defaultValuestring''
maskedbooleanfalseShow • instead of the characters (shadcn-vue mask; renamed: mask is a universal attribute).
patternPinPattern
PinPattern = 'digits' | 'alphanumeric'
'digits'
groupsnumber[] | undefinedundefinedSlot groups separated by a dash, e.g. [3, 3]; must add up to length.
disabledbooleanfalse
invalidbooleanfalse
labelResourceStr$r('app.string.spark_one_time_code')Accessible name.
EventTypeDefaultDescription
onValueChange(v: string) => void() => { }
onComplete(v: string) => void() => { }Fired when all slots are filled.

MIT Licensed