SignUpCard

A complete sign-up card. Name, email and a password with a live strength meter, a required terms checkbox, inline errors, and a button that morphs through creating, done and try again. A rejected sign-up shakes the card. Auth.

Open playground

Create your account

It takes less than a minute.

Use at least 8 characters
Have an account? Sign in

Use taken@smoui.dev to see it fail.

About

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

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

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

<SignUpCard
  onSubmit={async ({ name, email, password }) => {
    await api.signUp(name, email, password); // throw new Error("...") to show a message
  }}
  terms={<>I agree to the <a href="/terms">terms</a></>}
  footer={<a href="/signin">Have an account? Sign in</a>}
/>

Props 5

onSubmit

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

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

Heading and line under it.

ReactNode
providers / footer

Other ways in above the form, and a line below the button.

ReactNode
terms

Label for the required checkbox. Pass links here.

ReactNodedefault "I agree to the terms"
minLength / submitLabel

Shortest password and button label.

number / ReactNodedefault 8 / "Create account"