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/email-otp

Email OTP

better-auth-ui/email-otp
FreeComponent

Email OTP plugin: passwordless sign-in with an emailed code, plus code-based replacements for email verification, password reset, and email changes.

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/email-otp.json

Source

src/components/auth/email-otp/email-otp.tsxbetter-auth-ui.com/r/email-otp.json · first 6 KB
1"use client"
2
3import { authMutationKeys } from "@better-auth-ui/core"
4import {
5 type EmailOtpAuthClient,
6 useAuth,
7 useAuthPlugin,
8 useSendVerificationOtp,
9 useSignInEmailOtp
10} from "@better-auth-ui/react"
11import { useIsMutating } from "@tanstack/react-query"
12import { type SyntheticEvent, useState } from "react"
13
14import { Button } from "@/components/ui/button"
15import {
16 Card,
17 CardContent,
18 CardDescription,
19 CardHeader,
20 CardTitle
21} from "@/components/ui/card"
22import {
23 Field,
24 FieldDescription,
25 FieldError,
26 FieldGroup,
27 FieldLabel,
28 FieldSeparator
29} from "@/components/ui/field"
30import { Input } from "@/components/ui/input"
31import { Spinner } from "@/components/ui/spinner"
32import { emailOtpPlugin } from "@/lib/auth/email-otp-plugin"
33import { useResendCooldown } from "@/lib/auth/use-resend-cooldown"
34import { useSignInContinuation } from "@/lib/auth/use-sign-in-continuation"
35import { cn } from "@/lib/utils"
36import { OpenEmailButton } from "../open-email-button"
37import { OtpField } from "../otp-field"
38import { ProviderButtons, type SocialLayout } from "../provider-buttons"
39
40export type EmailOtpProps = {
41 className?: string
42 socialLayout?: SocialLayout
43 socialPosition?: "top" | "bottom"
44}
45
46/**
47 * Passwordless sign-in with an emailed one-time code.
48 *
49 * Two steps on one route: enter an email, then enter the code that arrives.
50 * The email step never reveals whether an account exists — the server decides
51 * whether the code creates an account, mirroring `emailOTP({ disableSignUp })`.
52 *
53 * @param socialLayout - Provider button layout.
54 * @param socialPosition - `"top"` or `"bottom"`. Defaults to `"bottom"`.
55 */
56export function EmailOtp({
57 className,
58 socialLayout,
59 socialPosition = "bottom"
60}: EmailOtpProps) {
61 const {
62 authClient,
63 basePaths,
64 emailAndPassword,
65 localization,
66 plugins,
67 socialProviders,
68 viewPaths,
69 Link
70 } = useAuth()
71 const { localization: emailOtpLocalization, otpLength } =
72 useAuthPlugin(emailOtpPlugin)
73
74 const otpClient = authClient as EmailOtpAuthClient
75 const continueSignIn = useSignInContinuation()
76 const { cooldown, isCoolingDown, startCooldown } = useResendCooldown()
77
78 const [email, setEmail] = useState("")
79 const [code, setCode] = useState("")
80 const [codeSent, setCodeSent] = useState(false)
81 const [fieldErrors, setFieldErrors] = useState<{ email?: string }>({})
82
83 const { mutate: sendVerificationOtp, isPending: isSending } =
84 useSendVerificationOtp(otpClient, {
85// … truncated

What it pulls in

npm packages

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

Other registry items

  • badge
  • button
  • card
  • field
  • https://better-auth-ui.com/r/radix-nova/account-settings.json
  • input
  • input-group
  • input-otp
  • skeleton
  • sonner
  • spinner
  • tooltip

Files it writes

  • src/lib/auth/auth-plugin.ts
  • src/lib/auth/email-otp-plugin.ts
  • src/lib/auth/use-resend-cooldown.ts
  • src/lib/auth/use-sign-in-continuation.ts
  • src/lib/auth/two-factor-methods.ts
  • src/components/auth/otp-field.tsx
  • src/components/auth/email-otp/email-otp.tsx
  • src/components/auth/email-otp/email-otp-button.tsx
  • src/components/auth/email-otp/verify-email-otp.tsx
  • src/components/auth/email-otp/forgot-password-otp.tsx
  • src/components/auth/email-otp/reset-password-otp.tsx
  • src/components/auth/email-otp/change-email-otp.tsx
  • src/components/auth/open-email-button.tsx
  • src/components/auth/provider-button.tsx
  • src/components/auth/provider-buttons.tsx
  • src/components/auth/last-login-method/last-used-badge.tsx
  • src/components/auth/use-is-hydrated.ts

Facts

Registry
better-auth-ui
Type
registry:component
Access
Free
Files written
17
Licence
MIT
In the index
at or before 2026-08-08
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

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex