Skip to content

Pin Input

A PIN input is a sequence of individual input fields used for securely entering short numeric codes, such as verification codes, passcodes, or authentication tokens.

Use the PIN input component when users must enter fixed-length numeric values, typically for security or validation steps (e.g., login, payment confirmation, or two-factor authentication).

Common alternative names:
Code Input, Verification Code, Passcode Entry, OTP (One-Time Password) Input


A standard PIN input with default settings for 5-digit codes.


A PIN input in disabled state that cannot be interacted with.


A PIN input displaying an error state with error styling and pre-filled content.


PropertyTypeDescription
lengthintThe number of PIN input fields to display. Default is 5.
onCompletedFunction(String)?Called when all PIN fields are completed.
autoFocusboolWhether the first field should automatically receive focus.
errorboolWhether the input should display in an error state. Default is false.
enabledboolWhether the input fields are enabled for interaction.
obscureTextboolWhether the input text should be obscured (hidden).
keyboardTypeTextInputTypeThe type of keyboard to display. Default is TextInputType.number.
textStyleTextStyle?Custom text style for the input text.
inputFormattersList<TextInputFormatter>List of input formatters to apply to the text input.
enableActiveFillboolWhether to enable active fill styling.
beforeTextPasteFunction(String?)?Callback to validate text before pasting.
animationTypeAnimationTypeThe type of animation to apply during field transitions.
animationDurationDurationDuration of the animation effects. Default is 300ms.
pinThemePinTheme?Custom pin theme configuration.
obscuringWidgetWidget?Custom widget to display when text is obscured.
mainAxisAlignmentMainAxisAlignmentHow to align the PIN fields horizontally. Default is center.
fieldOuterPaddingEdgeInsetsGeometryPadding around each input field. Default is horizontal 8px.
fieldWidthdoubleWidth of each individual input field. Default is 48px.
activeBorderWidthdoubleBorder width when a field is active (focused). Default is 1.0.
selectedBorderWidthdoubleBorder width when a field is selected. Default is 2.5.
cursorColorColorColor of the text cursor. Default is transparent.
enablePinAutofillboolWhether to enable PIN autofill from system suggestions.
autoDismissKeyboardboolWhether to automatically dismiss keyboard when PIN is completed.
autoFocusOnLoadboolWhether to automatically focus the first field when widget loads.
validatorFunction(String?)?Validation function for the PIN input.
shapePinCodeFieldShapeThe shape of the input fields. Default is circle.
activeBoxShadowList<BoxShadow>?Custom box shadow for active fields.
errorTextMarginEdgeInsetsMargin for error text display. Default is zero.
selectedFillColorColor?Fill color for selected fields.
activeFillColorColor?Fill color for active (focused) fields.
inactiveFillColorColor?Fill color for inactive fields.
selectedColorColor?Border color for selected fields.
activeColorColor?Border color for active (focused) fields.
inactiveColorColor?Border color for inactive fields.
errorBorderColorColor?Border color when in error state.
disabledColorColor?Color when the input is disabled.
onSubmittedFunction(String)?Called when the user submits the input.
onChangedFunction(String)?Called whenever the input value changes.
onEditingCompleteFunction()?Called when the user finishes editing.
controllerTextEditingController?Controller for managing the input text programmatically.