A Bootstrap 5 passwordless login form that asks only for an email address and then switches to a "Check your inbox" confirmation with a resend timer. Use it for magic link sign-in on SaaS apps, newsletters, communities and any product that wants to skip passwords.
How it works
The root section.mlk-auth paints a violet gradient with a dot grid and centers the white .mlk-card. The card contains two panels: .mlk-panel--form with the email form, a "Keep me signed in" checkbox, the .mlk-submit button and a passkey alternative, and .mlk-panel--sent, which starts with the hidden attribute and holds an inline SVG envelope, the confirmation text and two short steps.
The script binds every .mlk-auth on DOMContentLoaded. The form uses novalidate; on submit it trims the address and calls checkValidity(). The email input combines type="email" with a pattern that requires a dot in the domain. An invalid form gets was-validated, aria-invalid and an aria-describedby that points to the error, and focus returns to the field. A valid form shows a spinner in the button and calls sendLink(), which is a short setTimeout in the demo. Then the panels swap, the address appears in .mlk-sent-email, focus moves to the "Check your inbox" heading and the .mlk-resend button counts down before it can be used again. Resending writes a confirmation into .mlk-status. .mlk-back returns to the form and selects the email so it can be corrected.
Customization
--mlk-accent,--mlk-accent-hoverand--mlk-accent-rgbon.mlk-authinstyle.css: recolor the buttons, links, checkbox and focus rings.--mlk-bg-fromand--mlk-bg-toon.mlk-auth: change the background gradient behind the card.--mlk-card-widthand--mlk-radiuson.mlk-auth: make the card wider or narrower and change its corner radius.data-mlk-cooldown="30"on.mlk-auth: set how many seconds the resend button stays locked.sendLink()inscript.js: replace the timeout with afetch()POST to your magic link endpoint and calldone()when it succeeds.- The "15 minutes" text in
.mlk-panel--sent: match it to the lifetime of your tokens. - Remove
.mlk-dividerand.mlk-altif you do not offer passkeys.
Use cases
- SaaS sign-in pages: visitors enter only an email and receive a magic link
- Membership sites: the form validates the address before simulating a send
- Account recovery flows: a check-your-inbox state confirms the email was sent
- Login screens: a resend timer prevents repeated requests after the magic link was sent
Accessibility
The section is labelled "Sign in" and the email field has a visible label, autocomplete="email" and a hint linked through aria-describedby. Errors are linked only while the field is invalid. During sending the submit button uses aria-disabled, so keyboard focus stays on it. After the swap, focus moves to the confirmation heading (tabindex="-1"), so screen reader users hear the new state, and the resend message is announced through role="status". Decorative SVGs and icons are aria-hidden. The entrance and envelope animations are disabled with prefers-reduced-motion: reduce.
Usage notes
Requires Bootstrap 5 and Bootstrap Icons. Always rate limit magic link requests on the server and show the same confirmation whether or not the address exists, so the form cannot be used to discover accounts.