Two factor and sign in
Magic link sent
Check your email: an animated envelope, the masked address, buttons that open the common mail apps, a resend link with a countdown and a way back to the password. Needs monsoon.js for the countdown.
Needs monsoon.js. The styles work on their own, and the behavior comes from the optional interactive layer: add <script src="https://cdn.jsdelivr.net/npm/monsooncss/dist/monsoon.js" defer></script> or import 'monsooncss/js'. See the interactive layer.
Example
<div class="auth-card">
<header class="auth-header">
<div class="auth-mail-visual" aria-hidden="true">
<svg viewBox="0 0 88 68">
<path d="M6 26 44 3l38 23" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" opacity=".45"/>
<g class="auth-mail-letter"><rect x="16" y="9" width="56" height="42" rx="4"/><path d="M25 20h24M25 28h38M25 36h30"/></g>
<path class="auth-mail-front" d="M6 26l38 24 38-24v34a4 4 0 0 1-4 4H10a4 4 0 0 1-4-4z"/>
</svg>
</div>
<h2 class="auth-title">Check your email</h2>
<p class="auth-description">We sent a sign in link to <span class="auth-destination">y•••@example.com</span>. The link works once and expires in 15 minutes.</p>
</header>
<div class="auth-mail-apps">
<a class="auth-mail-app" href="https://mail.google.com/" target="_blank" rel="noopener"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2.5"/><path d="m3.5 7.5 8.5 6 8.5-6"/></svg> Gmail</a>
<a class="auth-mail-app" href="https://outlook.live.com/mail/" target="_blank" rel="noopener"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2.5"/><path d="m3.5 7.5 8.5 6 8.5-6"/></svg> Outlook</a>
<a class="auth-mail-app" href="message://"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2.5"/><path d="m3.5 7.5 8.5 6 8.5-6"/></svg> Apple Mail</a>
</div>
<p class="auth-alt"><span>Didn't get it? Check spam or <button type="button" class="link link-primary" data-m-auth-resend data-m-auth-resend-seconds="60">resend the link</button></span></p>
<footer class="auth-footer"><a class="link link-muted inline-flex items-center gap-1.5" href="#password"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5m0 0 5.5-5.5M5 12l5.5 5.5"/></svg> Sign in with a password instead</a></footer>
</div>JavaScript API
Attribute
data-m-auth-resend
Options
| Option | Description |
|---|---|
data-m-auth-resend-seconds="60" | |
data-m-auth-resend-idle |
Methods
| Method | Description |
|---|---|
Monsoon.authResend(el).start(60) | |
Monsoon.authResend(el).remaining |
Events
| Event | Description |
|---|---|
monsoon:auth-resend { seconds } | |
monsoon:auth-resend-ready |
Classes
6 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Part | Part of the magic link sent. On a <div> in the example. Sets width, height, margin, text color and overflow.CSS |
|
| Part | Part of the magic link sent. On a <g> in the example. Sets animation and icon color.CSS |
|
| Part | Part of the magic link sent. On a <path> in the example. Sets icon color.CSS |
|
| Part | Part of the magic link sent. On a <div> in the example. Sets grid display, grid tracks and gap.CSS |
|
| Part | Part of the magic link sent. On an <a> in the example. Sets flex display, alignment, gap, height, padding and text size.CSS |
|
| Base | Base class of the magic link sent. On a <footer> in the example. Sets margin, padding, text size, text style, text color and background.CSS |
Usage
The styles ship inside the same stylesheet as the utilities, and the behavior comes from the optional monsoon.js script, which enhances any element with a matching data-m attribute, including markup added later.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<script src="https://cdn.jsdelivr.net/npm/monsooncss/dist/monsoon.js" defer></script>
<!-- Magic link sent: start from the base class, then add modifiers -->
<div class="auth-card">
<header class="auth-header">
<div class="auth-mail-visual" aria-hidden="true">
<svg viewBox="0 0 88 68">
<path d="M6 26 44 3l38 23" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" opacity=".45"/>
<g class="auth-mail-letter"><rect x="16" y="9" width="56" height="42" rx="4"/><path d="M25 20h24M25 28h38M25 36h30"/></g>
<path class="auth-mail-front" d="M6 26l38 24 38-24v34a4 4 0 0 1-4 4H10a4 4 0 0 1-4-4z"/>
</svg>
</div>
<h2 class="auth-title">Check your email</h2>
<p class="auth-description">We sent a sign in link to <span class="auth-destination">y•••@example.com</span>. The link works once and expires in 15 minutes.</p>
</header>
<div class="auth-mail-apps">
<a class="auth-mail-app" href="https://mail.google.com/" target="_blank" rel="noopener"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2.5"/><path d="m3.5 7.5 8.5 6 8.5-6"/></svg> Gmail</a>
<!-- the full example is in the Code tab above -->Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Use
buttonfor actions andafor navigation. Icon only buttons need anaria-label; decorative icons carryaria-hidden="true". - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.