MagicLinkForm

Passwordless sign-in. Enter an email and the form hands over to a check-your-inbox card with a drawn tick, a resend countdown and a way back to fix a typo. Auth.

Open playground

Sign in with email

We will send you a link. No password needed.

Any email works. Start with "fail" to see an error.

About

MagicLinkForm is a React component in the Auth category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { MagicLinkForm } from "@ashutoshswamy/smoui" and set onSend, title, resendSeconds.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { MagicLinkForm } from "@ashutoshswamy/smoui";

<MagicLinkForm onSend={(email) => api.sendMagicLink(email)} resendSeconds={30} />

Props 3

onSend

Send the link. Resolve to succeed. Reject with an Error and its message shows under the field.

(email: string) => void | Promise<unknown>
title / description

Heading and line under it.

string
resendSeconds

Seconds before Resend unlocks.

numberdefault 30