BETTER-AUTH. UI
Plugins

Delete User

Add account deletion with confirmation dialog to your authentication flow.

The delete-user plugin renders the UI for Better Auth's built-in account deletion feature. Users can permanently delete their account with a confirmation dialog via the <DeleteAccount /> card, wrapped by <DangerZone /> in security settings.

Setup

Enable account deletion in Better Auth

Account deletion is built into Better Auth core — there's no separate plugin to install. Enable it by setting user.deleteUser.enabled to true:

lib/auth.ts
import { betterAuth } from "better-auth"

export const auth = betterAuth({
  // ...
  user: {
    deleteUser: { 
      enabled: true
    } 
  }
})

Once enabled, authClient.deleteUser() is available on the client — no client plugin is required. For OAuth users (who don't have a password), also provide sendDeleteAccountVerification so they can confirm deletion via email. See the Better Auth docs for the full options.

Register the UI plugin

Pass deleteUserPlugin() to <AuthProvider>:

components/providers.tsx
import { AuthProvider } from "@better-auth-ui/heroui"
import { deleteUserPlugin } from "@better-auth-ui/heroui/plugins"

<AuthProvider
  authClient={authClient}
  navigate={navigate}
  plugins={[deleteUserPlugin()]} 
>
  {children}
</AuthProvider>

Components

<DangerZone />

Danger zone

Delete account

Permanently remove your account and all associated data. This cannot be undone.

The <DangerZone /> card is automatically rendered in <SecuritySettings /> when the plugin is registered. It renders a danger zone heading and the <DeleteAccount /> card below it.

Usage

import { DangerZone } from "@better-auth-ui/heroui/plugins"

<DangerZone />

Props

Prop

Type

<DeleteAccount />

The delete account card with confirmation dialog. Used inside <DangerZone /> by default; import it directly if you need a custom layout.

Usage

import { DeleteAccount } from "@better-auth-ui/heroui/plugins"

<DeleteAccount />

Props

Prop

Type

Options

Prop

Type

Localization

Prop

Type

Last updated on

On this page