SignInCard

A complete sign-in card. Real form semantics (Enter submits, autofill works), inline field errors, and a submit button that morphs through signing in, signed in and try again. A rejected sign-in shakes the card and shows your error. Auth.

Open playground

Welcome back

Sign in to your workspace.

Forgot password?

Try demo@smoui.dev with smoui123, or anything else to see it fail.

About

SignInCard 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 { SignInCard } from "@ashutoshswamy/smoui" and set onSubmit, title, providers among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

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

<SignInCard
  onSubmit={async ({ email, password, remember }) => {
    await api.signIn(email, password, remember); // throw new Error("...") to show a message
  }}
  providers={<PasskeyButton onAuthenticate={passkey} />}
  footer={<a href="/signup">Create an account</a>}
/>

Props 5

onSubmit

Your sign-in call. Resolve to succeed. Reject with an Error and its message appears on the card.

(values: { email; password; remember }) => void | Promise<unknown>
title / description

Heading and line under it.

ReactNode
providers

Other ways in (single sign-on, passkey), shown above the form.

ReactNode
footer

Below the button: create an account and the like.

ReactNode
forgotHref / submitLabel

Forgot-password link and button label.

string / ReactNodedefault "#" / "Sign in"