Skip to main content
← Back to Table of Contents

Summary

OTP / verification code input with grouped digit boxes, paste support, optional auto-submit, loading indicator, and optional account-verify chrome (heading, description, footer link action).

Basic usage

Standard 6-digit OTP

Alphanumeric with auto-submit


State & validation

Stored value

After successful validation, state is a normalized string of exactly length() ASCII characters. An optional field may store an empty string. Leading zeroes remain intact. Separators are display-only.

Validation rules


Configuration API

All methods accept Closure unless noted.

submitUsing()

Run a PHP callback when the code is complete. Inject $state, $livewire, $set, etc.
Use either submitUsing() or autoSubmitMethod() on an instance. Configuring both throws a configuration exception. autoSubmit() alone enables the feature but requires one of those handlers. A complete value loaded from the server does not automatically submit on initialization. PHP callbacks run only for valid complete state changes; oversized codes and invalid suffixes are rejected before the callback. submitUsing() enables live updates with a 250ms debounce unless already configured. The Livewire method receives the string as its first argument. Validate it in that method, check the actual OTP, enforce expiry and attempt limits, and authorize the operation there. The field validates format; it does not issue or authenticate codes.
Only the submitting field becomes pending while its method request runs; other verification fields remain editable. A rejected request restores the inputs and shows a translated error with a Try again button. Enter also retries that failed request. An unchanged completed code does not repeatedly auto-submit. Editing it or explicitly retrying allows another request. Server validation errors use the normal Filament field error presentation. Completing a transport request does not itself establish that the OTP was accepted by your application. loading() reserves spinner space without a layout jump. The spinner follows the instance’s method promise or Livewire updates targeted at that field’s state path.

footerAction()

Register a link-style action (e.g. Resend):

Real-world examples

Account verification screen

2FA backup codes


Playground

/admin/flex-fields/verification-code See Playground for setup.

CSS classes (reference)


Keyboard, autofill and RTL

  • Each cell has a translated digit label and uses inputmode="numeric" or text.
  • The first cell advertises autocomplete="one-time-code". A complete autofilled code is distributed across all cells.
  • Pasting a code replaces the whole code, strips separators and uppercases ASCII letters in alphanumeric mode.
  • Typing advances immediately. Backspace clears the current digit or moves back from an empty cell; Delete clears the current cell.
  • Arrow keys, Home and End move focus without scrolling the page. Modified shortcuts and IME composition remain available.
  • Surrounding headings and footer actions follow RTL. The code sequence stays LTR, keeping numeric/alphanumeric codes in their canonical order; physical Left/Right arrows follow that sequence.
  • A reset or value change from Livewire updates every cell. Dynamic disabled/length/groups configurations replace only that instance.
  • All sizes keep their existing geometry; inputs shrink within narrow containers and honor the configured rounding token. Very long codes keep a readable minimum cell width and scroll inside the field; focus reveals the active cell without scrolling the page.

Performance

Last modified on October 16, 2026