BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/better-auth-ui/reset-password

Reset Password

better-auth-ui/reset-password
FreeComponent

A form component for resetting password with a token from the URL.

Live preview

live · rendered by the registry
Rendered by better-auth-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://better-auth-ui.com/r/reset-password.json

Source

src/components/auth/reset-password.tsxbetter-auth-ui.com/r/reset-password.json · first 6 KB
1"use client"
2
3import { getAuthLinkURL } from "@better-auth-ui/core"
4import { useAuth, useResetPassword } from "@better-auth-ui/react"
5import { Eye, EyeOff } from "lucide-react"
6import { type SyntheticEvent, useEffect, useState } from "react"
7import { toast } from "sonner"
8
9import { Button } from "@/components/ui/button"
10import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
11import {
12 Field,
13 FieldDescription,
14 FieldError,
15 FieldGroup,
16 FieldLabel
17} from "@/components/ui/field"
18import {
19 InputGroup,
20 InputGroupAddon,
21 InputGroupButton,
22 InputGroupInput
23} from "@/components/ui/input-group"
24import { Spinner } from "@/components/ui/spinner"
25import { cn } from "@/lib/utils"
26
27export type ResetPasswordProps = {
28 className?: string
29}
30
31/**
32 * Render a password reset form that validates the reset token from the URL, accepts a new password (and optional confirmation), and submits it to the auth client.
33 *
34 * The component checks for a `token` query parameter on mount and, if missing, shows an error toast and navigates to the sign-in page. It exposes per-field validation messages, toggles for password visibility, and disables inputs while the reset request is pending.
35 *
36 * @returns The password reset form UI ready to be mounted in the app layout.
37 */
38export function ResetPassword({ className }: ResetPasswordProps) {
39 const {
40 authClient,
41 basePaths,
42 emailAndPassword,
43 localization,
44 navigate,
45 redirectTo,
46 viewPaths,
47 Link
48 } = useAuth()
49 const signInURL = getAuthLinkURL(
50 `${basePaths.auth}/${viewPaths.auth.signIn}`,
51 redirectTo
52 )
53
54 const { mutate: resetPassword, isPending } = useResetPassword(authClient, {
55 onSuccess: () => {
56 toast.success(localization.auth.passwordResetSuccess)
57 navigate({ to: signInURL })
58 }
59 })
60
61 const [isPasswordVisible, setIsPasswordVisible] = useState(false)
62 const [isConfirmPasswordVisible, setIsConfirmPasswordVisible] =
63 useState(false)
64
65 const [fieldErrors, setFieldErrors] = useState<{
66 password?: string
67 confirmPassword?: string
68 }>({})
69
70 useEffect(() => {
71 const searchParams = new URLSearchParams(window.location.search)
72 const token = searchParams.get("token") as string
73
74 if (!token) {
75 toast.error(localization.auth.invalidResetPasswordToken)
76 navigate({ to: signInURL })
77 }
78 }, [localization.auth.invalidResetPasswordToken, navigate, signInURL])
79
80 function handleSubmit(e: SyntheticEvent<HTMLFormElement>) {
81// … truncated

What it pulls in

npm packages

  • @better-auth-ui/react@latest
  • @better-auth-ui/core@latest
  • better-auth
  • lucide-react

Other registry items

  • button
  • card
  • field
  • input-group
  • sonner
  • spinner

Files it writes

  • src/components/auth/reset-password.tsx

Facts

Registry
better-auth-ui
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on better-auth-ui better-auth-ui.com better-auth-ui/better-auth-ui on GitHub Raw registry item This item as JSON

More from better-auth-ui

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Account Settingsaccount-settingsbetter-auth-uiComponentsFree2 deps
Active Sessionsactive-sessionsbetter-auth-uiComponentsFree5 deps · 2 files
Additional Fieldadditional-fieldbetter-auth-uiComponentsFree5 deps
Adminadminbetter-auth-uiComponentsFree4 deps · 3 files
Anonymousanonymousbetter-auth-uiComponentsFree4 deps · 3 files
API Keyapi-keybetter-auth-uiComponentsFree4 deps · 10 files
Authauthbetter-auth-uiComponentsFree2 deps
Auth Providerauth-providerbetter-auth-uiComponentsFree4 deps · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex