Skip to content

Magic Link Passwordless Login Form

Bootstrap 5 email-only login form that validates the address, simulates sending a magic link and shows a check-your-inbox state with a resend timer.

Also known as: passwordless login form, email login link, magic link sign in, login without password, email only login

Magic Link Passwordless Login Form live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

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-hover and --mlk-accent-rgb on .mlk-auth in style.css: recolor the buttons, links, checkbox and focus rings.
  • --mlk-bg-from and --mlk-bg-to on .mlk-auth: change the background gradient behind the card.
  • --mlk-card-width and --mlk-radius on .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() in script.js: replace the timeout with a fetch() POST to your magic link endpoint and call done() when it succeeds.
  • The "15 minutes" text in .mlk-panel--sent: match it to the lifetime of your tokens.
  • Remove .mlk-divider and .mlk-alt if 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.

Magic Link Passwordless Login Form at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Login & Sign Up
License
Free for personal and commercial use

Questions about this template

Can I use the Magic Link Passwordless Login Form code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Magic Link Passwordless Login Form – free Bootstrap 5 login & sign up form template
Magic Link Passwordless Login Form · free Bootstrap 5 login & sign up form template

More Login & Sign Up

Login Form with Floating Labels – free Pure CSS login & sign up form template

Login Form with Floating Labels

Clean pure CSS login card with animated floating labels, show/hide password, inline validation and a simulated sign-in state in vanilla JavaScript.

Forgot Password Form – free Tailwind CSS login & sign up form template

Forgot Password Form

Tailwind CSS forgot password form with email validation, loading spinner, check-your-inbox success state and a resend cooldown timer.

Signup Form with Validation – free Bootstrap 5 login & sign up form template

Signup Form with Validation

Bootstrap 5 signup form with live password rules, a strength meter, show/hide toggle, password confirmation and a required terms checkbox.

Split Login Page with Image – free Bootstrap 6 login & sign up form template

Split Login Page with Image

Bootstrap 6 split-screen login page with a full-height photo and testimonial on one side and a floating-label form with Google and Apple sign-in on the other.

Forgot Password Form – free Bootstrap 6 login & sign up form template

Forgot Password Form

Bootstrap 6 forgot password form with an email field, inline validation, a loading button, a stepper and a check-your-inbox success state with resend timer.

Login and Signup Tabs – free Bootstrap 6 login & sign up form template

Login and Signup Tabs

Bootstrap 6 card with segmented tabs that switch between a sign-in form and a create-account form, with validation, cross-links and simulated submits.