One-time password digits coloured by any tone class (.mdst-danger, .mdst-success, and friends). Auto-advance and paste are a few lines of your own JavaScript; the docs include an example.
Structure
| Class | Example |
|---|---|
| .mdst-otp-input |
|
| .mdst-otp-input__separator |
|
States
| Class | Example |
|---|---|
| .mdst-otp-input .mdst-danger |
|
| .mdst-otp-input .mdst-success |
|
Note: This preview uses JavaScript to handle paste support and auto-advance to the next input. Without JS, the inputs still work but require manual tabbing between fields.
Usage
<!-- 4-digit code -->
<div class="mdst-otp-input">
<input type="text" maxlength="1" inputmode="numeric" />
<input type="text" maxlength="1" />
<input type="text" maxlength="1" inputmode="numeric" />
<input type="text" maxlength="1" />
</div>
<!-- With separator -->
<div class="mdst-otp-input">
<input type="text" maxlength="1" inputmode="numeric" />
<input type="text" maxlength="1" />
<span class="mdst-otp-input__separator"></span>
<input type="text" maxlength="1" inputmode="numeric" />
<input type="text" maxlength="1" />
</div>
<!-- Error state -->
<div class="mdst-otp-input mdst-danger">...</div>
<!-- Success state -->
<div class="mdst-otp-input mdst-success">...</div>