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/auth-provider

Auth Provider

better-auth-ui/auth-provider
FreeComponent

Wraps the Better Auth UI provider and mounts an ErrorToaster that surfaces query and mutation failures via sonner.

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/auth-provider.json

Source

src/components/auth/auth-provider.tsxbetter-auth-ui.com/r/auth-provider.json
1import {
2 AuthProvider as AuthProviderPrimitive,
3 type AuthProviderProps
4} from "@better-auth-ui/react"
5import type {
6 ComponentPropsWithoutRef,
7 ComponentType,
8 PropsWithChildren,
9 ReactNode
10} from "react"
11
12import { ErrorToaster } from "./error-toaster"
13
14declare module "@better-auth-ui/core" {
15 interface AuthConfig {
16 /**
17 * React component used to render internal navigation links.
18 * Typically TanStack Router's `Link` or Next.js's `Link`.
19 */
20 Link: ComponentType<
21 PropsWithChildren<
22 { className?: string; href: string; to?: string } & Pick<
23 ComponentPropsWithoutRef<"a">,
24 "aria-disabled" | "tabIndex" | "onClick"
25 >
26 >
27 >
28 }
29
30 /** Widen `AdditionalField.label` to `ReactNode` in the shadcn package. */
31 interface AdditionalFieldRegister {
32 label: ReactNode
33 }
34}
35
36/**
37 * Provides an authentication context by rendering an auth provider with the sonner toast handler injected, forwarding remaining configuration and rendering `children` inside it.
38 *
39 * @param children - React nodes to render inside the authentication provider
40 * @returns A React element that renders an authentication provider configured with the provided props and toast handler
41 */
42export function AuthProvider({ children, ...config }: AuthProviderProps) {
43 return (
44 <AuthProviderPrimitive {...config}>
45 {children}
46
47 <ErrorToaster />
48 </AuthProviderPrimitive>
49 )
50}

What it pulls in

npm packages

  • @better-auth-ui/react@latest
  • @better-auth-ui/core@latest
  • @tanstack/react-query
  • better-auth

Other registry items

  • sonner

Files it writes

  • src/components/auth/auth-provider.tsx
  • src/components/auth/error-toaster.tsx

Facts

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

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 Redirectauth-redirectbetter-auth-uiComponentsFree3 deps
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