Get License
Free
Pro

OTP Input

A one-time password / PIN input with individually-focusable boxes. Supports auto-advance on type, keyboard navigation, paste, and Angular Forms integration. Emits (completed) when all boxes are filled.

freenew

6-Digit OTP

Default configuration with length="6" and numbersOnly="true".

Current value:

HTML

4-Digit PIN


HTML

Masked (Password)

Set [mask]="true" to hide the digits as password dots.


HTML

Disabled State

Installation

Run the following command to add this component to your project:

bash

npx base-ui-cli add otp-input

API Reference

For AI agents

Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.

bash

npx -y base-ui-mcp

Base UI provides standalone components. Import the exact elements you want to use into your component.

typescript (Example)

// Install: npx base-ui-cli add otp-input
// Paths are relative to aliases.components (default: src/app/components)
import { OtpInputComponent } from './otp-input/otp-input.component';

@Component({
  selector: 'app-your-component',
  imports: [
    OtpInputComponent
  ],
  template: `...`
})
export class YourComponent {}

API for otp-input — generated from JSDoc in the library source.

API reference for otp-input
APIMemberTypeDefaultDescription
base-otp-inputclassstring''Additional host CSS classes (merged via cn()).
base-otp-inputlengthnumber6
base-otp-inputmaskbooleanfalse
base-otp-inputnumbersOnlybooleantrue
base-otp-input(completed)stringEmitted when all boxes are filled with the full code string.
base-otp-inputdisabledbooleanfalseWhether the control is disabled (consumer-facing input).