How can I help you?
Styling Modes in Angular OTP Input component
26 Feb 20266 minutes to read
Styling modes define the visual presentation of the OTP input fields. Choose a styling mode based on your design requirements and user experience goals. Three predefined modes are available: outlined (default), filled, and underlined.
Outlined mode
The outlined style displays input fields with a visible border and background. This is the default styling mode and provides clear visual boundaries for each OTP field. Set the stylingMode property to outlined to apply this style.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule } from '@angular/forms'
import { OtpInputModule } from '@syncfusion/ej2-angular-inputs'
import { enableRipple } from '@syncfusion/ej2-base'
import { Component } from '@angular/core';
@Component({
imports: [
FormsModule, OtpInputModule
],
standalone: true,
selector: 'app-root',
template: `<!-- To Render OTP Input component. -->
<div class="wrap">
<div id='otp-container' style="width: 350px;">
<div ejs-otpinput stylingMode="outlined"></div>
</div>
</div>`
})
export class AppComponent { }import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));/* Represents the styles for loader */
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
.wrap {
margin: 50px auto;
}Filled mode
The filled style displays input fields with a solid background color and no border, creating a modern, compact appearance. Use this mode for designs that emphasize background-based separation. Set the stylingMode property to filled to apply this style.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule } from '@angular/forms'
import { OtpInputModule } from '@syncfusion/ej2-angular-inputs'
import { enableRipple } from '@syncfusion/ej2-base'
import { Component } from '@angular/core';
@Component({
imports: [
FormsModule, OtpInputModule
],
standalone: true,
selector: 'app-root',
template: `<!-- To Render OTP Input component. -->
<div class="wrap">
<div id='otp-container' style="width: 350px;">
<div ejs-otpinput stylingMode="filled"></div>
</div>
</div>`
})
export class AppComponent { }import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));/* Represents the styles for loader */
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
.wrap {
margin: 50px auto;
}Underlined mode
The underlined style displays input fields with only a bottom border, creating a minimalist appearance. This mode is useful for space-constrained interfaces or mobile applications. Set the stylingMode property to underlined to apply this style.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule } from '@angular/forms'
import { OtpInputModule } from '@syncfusion/ej2-angular-inputs'
import { enableRipple } from '@syncfusion/ej2-base'
import { Component } from '@angular/core';
@Component({
imports: [
FormsModule, OtpInputModule
],
standalone: true,
selector: 'app-root',
template: `<!-- To Render OTP Input component. -->
<div class="wrap">
<div id='otp-container' style="width: 350px;">
<div ejs-otpinput stylingMode="underlined"></div>
</div>
</div>`
})
export class AppComponent { }import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));/* Represents the styles for loader */
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
.wrap {
margin: 50px auto;
}