Input OTP

Accessible one-time password component with copy-paste support and customizable slot styling.

The Input OTP component provides a user-friendly way to collect verification codes. It supports automatic focus management, masking, and seamless copy-paste integration.

Default OTP

A standard 6-digit configuration using groups and a separator for better readability.

Standard 6-digit verification code

Reactive Forms

Enhanced integration with Angular Reactive Forms, including state feedback and custom paste logic.

Secure Verification

Please enter the 6-digit code sent to your email.

Value: ------

Installation & Usage

Installation

Imports

Basic Skeleton

Animation

Ensure you have the following caret animation in your global styles (e.g., styles.css):

API Reference

Brain API (Functional)

The functional logic provided by BrnInputOtp.

PropTypeDescription
maxLengthnumberThe length of the one-time password.
disabledbooleanWhether the component is disabled.
transformPastefuncA function to transform pasted text (e.g., removing dashes).
(completed)EventEmitterEmitted when the OTP reaches the maxLength.

Helm API (Styling)

The helm directives provide the default spartan/ui styling.

DirectiveSelectorDescription
HlmInputOtp[hlmInputOtp]Root styling for the OTP component.
HlmInputOtpGroup[hlmInputOtpGroup]Groups multiple slots together.
HlmInputOtpSlothlm-input-otp-slotRenders an individual digit slot.
HlmInputOtpSeparatorhlm-input-otp-separatorDecorative separator between groups.