Skip to content
Product block

Password Reset Request

Reset-link request with a sent state worded to avoid leaking whether an account exists.

133 lineslucide-reactAdded 8 Aug 2026Updated 10 Sept 2026
  • forgot password
  • reset
  • auth
  • email

What's included

  • components/auth-forgot-password.tsx
  • Needs lucide-react

Works with

  • React
  • Next.js
  • Tailwind CSS
  • TypeScript

npx hoverlab add auth-forgot-password

Or over MCP, from your editor's agent — no account needed.

License

Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.

Was this useful?

Start a page with this section — add more, order them, and leave with the page source.

Preview

Reset your password

Enter your email and we will send you a link to set a new one.

Back to sign in

Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.

Source

components/auth-forgot-password.tsx
'use client'

/**
 * <AuthForgotPassword> — request a reset link.
 *
 * The success state confirms that a link was sent *if the account exists*,
 * and says so in those words. Confirming outright that mail went to an
 * address turns this form into an account-enumeration oracle, and it is
 * the one place where the honest-sounding message is the insecure one.
 *
 * The whole card swaps to the sent state rather than showing a banner above
 * the form — leaving the field in place invites a second submit, and a
 * resend is a different action with its own cooldown.
 */

import * as React from 'react'
import { ArrowLeft, Loader2, MailCheck } from 'lucide-react'

export interface AuthForgotPasswordProps {
  heading?: string
  subheading?: string
  onSubmit?: (email: string) => Promise<void>
  loginHref?: string
  /**
   * Render as a demo inside a larger page, which drops the email field's
   * `autoFocus`. Focusing an input scrolls the browser to it, so a card in
   * a preview grid would drag the visitor down the page on load.
   */
  embedded?: boolean
  className?: string
}

export function AuthForgotPassword({
  heading = 'Reset your password',
  subheading = 'Enter your email and we will send you a link to set a new one.',
  onSubmit,
  loginHref = '/login',
  embedded = false,
  className = '',
}: AuthForgotPasswordProps) {
  // Per-instance ids. A literal id in a reusable component is a
  // collision waiting for the second copy on the page — and a <label>
  // then resolves to whichever input rendered first.
  const uid = React.useId()
  const [email, setEmail] = React.useState('')
  const [busy, setBusy] = React.useState(false)
  const [sent, setSent] = React.useState(false)

  async function handleSubmit(event: React.FormEvent) {
    event.preventDefault()
    if (busy) return
    setBusy(true)
    try {
      await onSubmit?.(email)
      setSent(true)
    } catch {
      // Same outcome either way — see the note above.
      setSent(true)
    } finally {
      setBusy(false)
    }
  }

  return (
    <div className={`flex min-h-96 w-full items-center justify-center p-6 ${className}`}>
      <div className="w-full max-w-sm rounded-2xl border border-border/60 bg-card/80 p-7 shadow-sm backdrop-blur">
        {sent ? (
          <div className="text-center">
            <div className="mx-auto mb-4 inline-flex h-11 w-11 items-center justify-center rounded-xl bg-emerald-500/15 text-emerald-600 dark:text-emerald-400">
              <MailCheck className="h-5 w-5" />
            </div>
            <h1 className="text-2xl font-bold tracking-tight">Check your inbox</h1>
            <p className="mt-2 text-sm text-muted-foreground">
              If an account exists for{' '}
              <span className="font-medium text-foreground">{email}</span>, a reset
              link is on its way. It expires in 30 minutes.
            </p>

            <button
              type="button"
              onClick={() => setSent(false)}
              className="mt-6 text-sm font-semibold hover:underline"
            >
              Use a different address
            </button>
          </div>
        ) : (
          <>
            <h1 className="text-2xl font-bold tracking-tight">{heading}</h1>
            <p className="mt-1.5 text-sm text-muted-foreground">{subheading}</p>

            <form onSubmit={handleSubmit} className="mt-6 space-y-4">
              <div>
                <label htmlFor={`${uid}-forgot-email`} className="mb-1.5 block text-sm font-medium">
                  Email
                </label>
                <input
                  id={`${uid}-forgot-email`}
                  type="email"
                  required
                  autoFocus={!embedded}
                  autoComplete="username"
                  value={email}
                  onChange={(e) => setEmail(e.target.value)}
                  placeholder="you@company.com"
                  className="w-full rounded-xl border border-border/60 bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-primary"
                />
              </div>

              <button
                type="submit"
                disabled={busy}
                className="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-60"
              >
                {busy ? <Loader2 aria-hidden className="h-4 w-4 animate-spin motion-reduce:[animation-duration:1.6s]" /> : null}
                {busy ? 'Sending' : 'Send reset link'}
              </button>
            </form>
          </>
        )}

        <a
          href={loginHref}
          className="mt-6 inline-flex w-full items-center justify-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground"
        >
          <ArrowLeft aria-hidden className="h-4 w-4 rtl:rotate-180" />
          Back to sign in
        </a>
      </div>
    </div>
  )
}

Before you paste

  • Styling is Tailwind utility classes on semantic tokens (bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.
  • Install: npm i lucide-react
  • Every prop has a default, so it renders standalone before you wire it up.

Where it goes

Drop it at components/auth-forgot-password.tsx and import it where you need the section:

import { AuthForgotPassword } from '@/components/auth-forgot-password'

Customize

4 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.

Props

Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.

PropTypeDefault
headingstring'Reset your password'
subheadingstring'Enter your email and we will send you a link…
onSubmit(email: string) => Promise<void>—
loginHrefstring'/login'
embeddedRender as a demo inside a larger page, which drops the email field's `autoFocus`. Focusing an input scrolls the browser to it, so a card in a preview grid would drag the visitor down the page on load.booleanfalse
classNamestring''

Not using React?

The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.

This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.

auth-forgot-password.html
<!--
  Password Reset Request — markup from the Hoverlab catalog.

  This is the block rendered once to HTML and wrapped as a component
  file. It is not a port of the React source: the Tailwind classes carry
  the design, which is the part that took the work, and they are the same
  in every framework.

  This block is interactive in React and the handlers are NOT here.
  Buttons, toggles and menus render in their initial state and do
  nothing until you wire them up.
-->
<div class="flex min-h-96 w-full items-center justify-center p-6 ">
  <div class="w-full max-w-sm rounded-2xl border border-border/60 bg-card/80 p-7 shadow-sm backdrop-blur">
    <h1 class="text-2xl font-bold tracking-tight">Reset your password</h1>
    <p class="mt-1.5 text-sm text-muted-foreground">Enter your email and we will send you a link to set a new one.</p>
    <form class="mt-6 space-y-4">
      <div>
        <label for="_R_0_-forgot-email" class="mb-1.5 block text-sm font-medium">Email</label>
        <input id="_R_0_-forgot-email" type="email" required="" autofocus="" autoComplete="username" placeholder="you@company.com" class="w-full rounded-xl border border-border/60 bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-primary" value="" />
      </div>
      <button type="submit" class="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-60">Send reset link</button>
    </form>
    <a href="/login" class="mt-6 inline-flex w-full items-center justify-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-left h-4 w-4 rtl:rotate-180" aria-hidden="true"><path d="m12 19-7-7 7-7"></path><path d="M19 12H5"></path></svg>Back to sign in</a>
  </div>
</div>
  • This is rendered HTML, not a translation of the React source. The Tailwind classes carry the design and work in any framework.
  • It is one frame: the component in its initial state, with no props applied beyond the defaults.
  • This block is interactive in React — toggles, menus or form state. None of that survives here; the markup is the closed/default state and the handlers are gone. Re-wire them in your own framework.
  • Requires Tailwind, and the design tokens the classes reference (bg-card, text-muted-foreground, and so on). The template ZIPs ship a globals.css that defines them.

What each framework gets across the whole catalog — effects convert properly; this rung is markup.

For AI

The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.

See the prompt

Used in these pages

Want the whole screen instead of this one section? Open a page and copy it entire.

8 more blocks in Authentication

All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.

Browse Authentication

Shipping one commercially

Copying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.

  • A commercial licence for everything in the catalog
  • Unlimited bundle exports, in Vue, Svelte and Tailwind
  • One payment — no subscription, nothing to renew
Pro — $79 once

More Authentication blocks

View category
Open the full page for this block

Split Signup With Proof

Registration form beside a testimonial panel, with live password rules and a proof column that drops rather than stacks on mobile.

Authentication205 lines1 dep
Open the full page for this block

One-Time Code Input

Six-box OTP entry that handles paste, backspace, arrow keys and iOS SMS autofill — the parts hand-rolled versions always miss.

Authentication184 lines1 dep
Open the full page for this block

New Password With Strength Meter

Set-a-new-password form with a four-step strength meter, confirm matching and errors announced rather than only coloured.

Authentication179 lines1 dep
Open the full page for this block

Two-Factor Challenge

Authenticator-code prompt with a backup-code escape hatch and an opt-in trusted-device checkbox that is off by default.

Authentication148 lines1 dep
Open the full page for this block

Email-First SSO Sign-In

Email first, then whatever that domain uses. The password field is absent rather than disabled when SSO is enforced, the button names the company it redirects to, and a personal address is a normal answer instead of an error.

Authentication257 lines1 dep
Open the full page for this block

Magic Link Sign In

Passwordless sign-in that says what will land in the inbox and how long it lasts, before the address is typed.

Authentication176 linesNo deps
Open the full page for this block

Enterprise SSO Split

What SSO actually covers, written for the person who has to configure it rather than the person who asked for it.

Authentication155 linesNo deps