Knit UI
GitHub

Playground

Loading playground…

false
false
false
false
true
true
Playground
<PinInput
  length={4}
  type="alphanumeric"
  size="sm"
  mask={false}
  disabled={false}
  error={false}
  readOnly={false}
  placeholder="○"
  manageFocus
  oneTimeCode
/>

Examples

Sizes

The seven token sizes from xxs to xxl, rendered side by side.

Loading example…

SizesSourceStorybook

Shadows

Each elevation of the inherited shadow prop applied to the field row.

Loading example…

ShadowsSourceStorybook

Disabled

Disabled state — all fields reject input and appear dimmed.

Loading example…

DisabledSourceStorybook

With Error

Error state — every field receives error styling and aria-invalid.

Loading example…

With ErrorSourceStorybook

Masked

Masked inputs — characters are hidden behind the platform password glyph.

Loading example…

MaskedSourceStorybook

Number Type

Numeric-only mode — only digit characters (0–9) are accepted.

Loading example…

Number TypeSourceStorybook

Six Digits

Six-digit code length, suitable for TOTP or SMS OTP flows.

Loading example…

Six DigitsSourceStorybook

Controlled

Controlled component — the parent holds the value in state and logs onComplete.

Loading example…

ControlledSourceStorybook

Read Only

Read-only — the pre-filled value is visible but cannot be changed.

Loading example…

Read OnlySourceStorybook

Styles

Per-slot styles targets individual parts — here the field spread onto every per-character input.

Loading example…

StylesSourceStorybook

Props

PropTypeDefaultDescription
ariaLabelstring | undefined"PinInput"`aria-label` applied to every input.
autoFocusboolean | undefinedfalseFocuses the first input on mount.
defaultValuestring | undefined—Uncontrolled component default value.
disabled systemboolean | undefinedfalseDisables every input.
errorboolean | undefinedfalseApplies error styles + `aria-invalid` to every input.
gap((number | SpaceTokens) & (string | number)) | undefined"$xs"Gap between inputs. Token, CSS value or number.
getInputProps((index: number) => Partial<InputProps>) | undefined—Props applied to each input, by index.
idstring | undefined—Base id used to generate per-input ids.
inputModePinInputMode | undefined—Host `inputmode` attribute, inferred from `type` if unset.
inputTypeHTMLInputTypeAttribute | undefined—Host `type` attribute, inferred from `type`/`mask` if unset.
lengthnumber | undefined4Number of individual input fields.
manageFocusboolean | undefinedtrueAdvance focus automatically to the next field after entry.
maskboolean | undefinedfalseRenders fields as password inputs.
onChange((value: string) => void) | undefined—Called when the value changes.
onComplete((value: string) => void) | undefined—Called once when every input has a value.
oneTimeCodeboolean | undefinedtrueSets autocomplete="one-time-code" on each field.
placeholderstring | undefined"○"Inputs placeholder.
radius systemstring | number | undefined—Border radius of each input.
readOnlyboolean | undefinedfalseWhen set, the user cannot edit the value.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined——
size systemInputSize | undefined
xxs · xs · sm · md · lg · xl · xxl
"md"Controls each field's width/height and font size.
styles systemSlotStyles<PinInputStyles> | undefined—Per-slot style sugar — props spread onto each per-character `Input`.
theme systemThemeName | null | undefined—Applies a theme to this element
typePinInputType | undefined
alphanumeric · number
"alphanumeric"Character set accepted by each field.
valuestring | undefined—Controlled component value.

Style slots

Every part of PinInput can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotTargets
fieldProps spread onto each per-character Input.
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 494 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.

Edit this page on GitHub