npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-signup-form

v1.0.6

Published

Beautiful, ready-to-use Login and SignUp form components for React

Downloads

734

Readme

react-signup-form

Beautiful, accessible, zero-dependency Login and Sign-Up form components for React.


Features

  • LoginForm — email + password with show/hide toggle and "Forgot password?" support
  • SignUpForm — first/last name, email, password with strength meter, confirm password, and terms checkbox
  • AuthForms — combined component that handles switching between the two forms
  • Animated overlay and card entrance
  • Built-in validation with inline error messages
  • Success state after submit
  • Fully customisable via props
  • TypeScript types included
  • No external dependencies (only peer: react)

Installation

npm install react-signup-form

or with Yarn:

yarn add react-signup-form

Quick Start

Combined Login + Sign-Up (recommended)

import { useState } from 'react';
import { AuthForms } from 'react-signup-form';

export default function App() {
  const [showAuth, setShowAuth] = useState(false);

  return (
    <>
      <button onClick={() => setShowAuth(true)}>Open Login</button>

      {showAuth && (
        <AuthForms
          onLogin={async ({ email, password }) => {
            console.log('Login:', email, password);
            // call your API here
          }}
          onSignUp={async ({ firstName, lastName, email, password }) => {
            console.log('Sign up:', firstName, lastName, email, password);
            // call your API here
          }}
          onForgotPassword={() => console.log('Forgot password clicked')}
          onClose={() => setShowAuth(false)}
        />
      )}
    </>
  );
}

Login Form only

import { LoginForm } from 'react-signup-form';

<LoginForm
  onLogin={async ({ email, password }) => {
    const ok = await myApi.login(email, password);
    if (!ok) return false; // prevents success state
  }}
  onForgotPassword={() => navigate('/forgot-password')}
  onSwitchToSignUp={() => setView('signup')}
  onClose={() => setOpen(false)}
/>

Sign-Up Form only

import { SignUpForm } from 'react-signup-form';

<SignUpForm
  onSignUp={async ({ firstName, lastName, email, password }) => {
    await myApi.register({ firstName, lastName, email, password });
  }}
  onSwitchToLogin={() => setView('login')}
  onClose={() => setOpen(false)}
/>

Props

<LoginForm />

| Prop | Type | Default | Description | |---|---|---|---| | onLogin | (values) => void \| Promise | — | Called on submit with { email, password }. Return false to block the success screen | | onForgotPassword | () => void | — | Shows "Forgot password?" link when provided | | onSwitchToSignUp | () => void | — | Shows "Sign up" link when provided | | onClose | () => void | — | Shows ✕ close button when provided | | loading | boolean | — | Controlled loading state | | error | string | — | Global error banner above the form | | overlay | boolean | true | Wraps the card in a dark blurred overlay | | logoSrc | string | — | Custom logo image URL | | title | string | "Welcome back" | Form heading | | buttonText | string | "Sign in" | Submit button label | | position | 'left' \| 'center' \| 'right' | 'left' | Aligns login header content | | className | string | — | Added to .raf-card so you can target your own overrides | | overlayClassName | string | — | Added to .raf-overlay when overlay is true |

<SignUpForm />

| Prop | Type | Default | Description | |---|---|---|---| | onSignUp | (values) => void \| Promise | — | Called with { firstName, lastName?, email, password } | | onSwitchToLogin | () => void | — | Shows "Sign in" link when provided | | onClose | () => void | — | Shows ✕ close button | | loading | boolean | — | Controlled loading state | | error | string | — | Global error banner | | overlay | boolean | true | Dark blurred overlay | | showLastName | boolean | true | Toggle last name field | | showConfirmPassword | boolean | true | Toggle confirm password field | | showTerms | boolean | true | Toggle terms checkbox | | showStrength | boolean | true | Toggle password strength bar | | logoSrc | string | — | Custom logo image URL | | title | string | "Create an account" | Form heading | | buttonText | string | "Create account" | Submit button label | | position | 'left' \| 'center' \| 'right' | 'left' | Aligns sign-up header content | | className | string | — | Added to .raf-card so you can target your own overrides | | overlayClassName | string | — | Added to .raf-overlay when overlay is true |

<AuthForms />

Accepts all props from both forms above, plus:

| Prop | Type | Default | Description | |---|---|---|---| | initialView | 'login' \| 'signup' | 'login' | Which form to show first | | loginError | string | — | Error for login form | | signUpError | string | — | Error for signup form | | loginLoading | boolean | — | Loading for login | | signUpLoading | boolean | — | Loading for signup | | position | 'left' \| 'center' \| 'right' | 'left' | Aligns header content in both forms | | className | string | — | Added to .raf-card in both views | | overlayClassName | string | — | Added to .raf-overlay in both views when overlay is enabled |


Handling API Errors

Pass an error string via the error (or loginError / signUpError) prop:

const [error, setError] = useState('');
const [loading, setLoading] = useState(false);

<LoginForm
  loading={loading}
  error={error}
  onLogin={async ({ email, password }) => {
    setLoading(true);
    setError('');
    try {
      await myApi.login(email, password);
    } catch (e) {
      setError('Invalid email or password. Please try again.');
      return false; // prevents success screen
    } finally {
      setLoading(false);
    }
  }}
/>

Inline (no overlay) Usage

Set overlay={false} to render just the card without the dark background:

<div style={{ display: 'flex', justifyContent: 'center', padding: 40 }}>
  <LoginForm overlay={false} onLogin={handleLogin} />
</div>

CSS Overrides

Use className / overlayClassName to attach your own selectors and override defaults:

<LoginForm
  className="my-login"
  overlayClassName="my-login-overlay"
  onLogin={handleLogin}
/>
.my-login.raf-card {
  max-width: 520px;
  border-radius: 24px;
}

.my-login .raf-submit-btn {
  background: #111827;
  box-shadow: none;
}

.my-login-overlay.raf-overlay {
  background: rgba(0, 0, 0, 0.75);
}