Headless / Account
Delete account
Compose delete account with the auth service and your own interface.
16 public parts · 1examples
@slices.sh/auth/headlessView as Markdown ↗Your design. Our behavior.
Explore the tree to see what each part controls. Gates reveal the relevant state; roots outline their scope.
User.Root · Scope
Installation
Choose what your component needs. Run these commands in an initialized Next.js app.
Before you start
The steps below run in a Next.js app with shadcn set up (it has a components.json). In an existing Next.js app, such as one from create-next-app, set shadcn up first:
npx shadcn@latest init -t next -b base -p novaOr start fresh: the slices CLI creates the app and sets it up.
npx slices.sh installInstall the service registry
Adds services/index.ts, which import "@/services" loads. A provider setup writes the same file, so skip this if your app has one.
npx add servicesInstall the headless library
npmAdd the React parts to your app, then compose them with your own elements.
npm install @slices.sh/auth@^0.1.10Import from @slices.sh/auth/headless.
Install the service
Connect the parts to a provider. Skip this step if this service is already configured in your app.
npx add auth.betterauth --auth-methods googleAdds service configuration and API routes to your app, with the provider dependencies. For a headless composition, add import "@/services" after "use client".
The slices CLI installs the service and provisions its required resources in one command.
Set BETTER_AUTH_URL to your app origin. Memory is for local development; use a persistent database for deployment. Neon and Supabase also require the migration script printed by the installer.
Provider setup notes
- BETTER_AUTH_SECRET signs every session and is generated into .env.local while this installs (32 random bytes, base64, nothing leaves the machine). Changing it signs everyone out; in production set the same one on every instance.
- The public origin (OAuth callbacks, the passkey domain) is the one each request comes to in development, and the deployment's own on Vercel. Elsewhere, or behind a proxy or a custom domain, set BETTER_AUTH_URL, such as https://acme.com.
Start small
Parts bring the behavior. Use their default elements, or supply your own with render.
"use client"import "@/services"import { DeleteAccount } from "@slices.sh/auth/headless"export function Example() { return ( <DeleteAccount.Root> <DeleteAccount.Dialog> <DeleteAccount.Trigger>Delete my account</DeleteAccount.Trigger> <DeleteAccount.Editing> <DeleteAccount.AddressLabel>Email</DeleteAccount.AddressLabel> <DeleteAccount.AddressInput /> <DeleteAccount.Confirm>Confirm deletion</DeleteAccount.Confirm> <DeleteAccount.Cancel>Cancel</DeleteAccount.Cancel> </DeleteAccount.Editing> </DeleteAccount.Dialog> <DeleteAccount.Error /> </DeleteAccount.Root> )}Requires an authenticated account. Organization controls also require organizations and the appropriate role.
API reference
Every public part used by this experience is listed below. Gates render children without adding an element. Element parts accept native element props and render; function children receive the state declared in their props. Scopes provide context rather than a visual element.
DeleteAccount.Rootscope
Available gates the section where the backend deletes accounts.
Capability: delete-account
Props
3 documented props
| Prop | Type | Default |
|---|---|---|
configThe auth config, a slug from the registry ( | string | — |
enabledLeft out or | Enabled | — |
childrenContent rendered inside this part. | ReactNode | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Rootfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/root.tsx
DeleteAccount.Availablegate
Available gates the section where the backend deletes accounts.
Capability: delete-account
Props
1 documented props
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Availablefrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/available.tsx
DeleteAccount.Dialogcontent
Dialog maps onto render={<AlertDialog />}. Trigger opens it. Target gets { target }, the address being deleted. Confirm schedules the deletion with { pending, retryAfter }. Cancel closes, or undoes a scheduled deletion, with { scheduled }.
Required scope
DeleteAccount.Dialog requires Root.
Props
2 documented props
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Dialogfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/dialog.tsx
DeleteAccount.Triggeraction · <button>
Dialog maps onto render={<AlertDialog />}. Trigger opens it. Target gets { target }, the address being deleted. Confirm schedules the deletion with { pending, retryAfter }. Cancel closes, or undoes a scheduled deletion, with { scheduled }.
Required scope
DeleteAccount.Trigger requires Root.
Props
2 documented props · Native <button> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Triggerfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/trigger.tsx
DeleteAccount.Cancelaction · <button>
Dialog maps onto render={<AlertDialog />}. Trigger opens it. Target gets { target }, the address being deleted. Confirm schedules the deletion with { pending, retryAfter }. Cancel closes, or undoes a scheduled deletion, with { scheduled }.
Required scope
DeleteAccount.Cancel requires Root.
Props
2 documented props · Native <button> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | ((state: { scheduled: boolean }) => ReactNode) | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Cancelfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/cancel.tsx
DeleteAccount.Confirmaction · <button>
Dialog maps onto render={<AlertDialog />}. Trigger opens it. Target gets { target }, the address being deleted. Confirm schedules the deletion with { pending, retryAfter }. Cancel closes, or undoes a scheduled deletion, with { scheduled }.
Required scope
DeleteAccount.Confirm requires Root.
Props
2 documented props · Native <button> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | ((state: { pending: boolean; retryAfter: number }) => ReactNode) | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Confirmfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/confirm.tsx
DeleteAccount.AddressInputinput · <input>
AddressInput and AddressLabel for the retyped address. PasswordRequired gates PasswordInput and PasswordLabel for an account that has a password.
Required scope
DeleteAccount.AddressInput requires Root.
Props
2 documented props · Native <input> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
AddressInputfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/address-input.tsx
DeleteAccount.AddressLabelcontent · <label>
AddressInput and AddressLabel for the retyped address. PasswordRequired gates PasswordInput and PasswordLabel for an account that has a password.
Required scope
DeleteAccount.AddressLabel requires Root.
Props
2 documented props · Native <label> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
AddressLabelfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/address-label.tsx
DeleteAccount.PasswordInputinput · <input>
AddressInput and AddressLabel for the retyped address. PasswordRequired gates PasswordInput and PasswordLabel for an account that has a password.
Required scope
DeleteAccount.PasswordInput requires Root.
Props
2 documented props · Native <input> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
PasswordInputfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/password-input.tsx
DeleteAccount.PasswordLabelcontent · <label>
AddressInput and AddressLabel for the retyped address. PasswordRequired gates PasswordInput and PasswordLabel for an account that has a password.
Required scope
DeleteAccount.PasswordLabel requires Root.
Props
2 documented props · Native <label> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
PasswordLabelfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/password-label.tsx
DeleteAccount.Targetcontent · <p>
Dialog maps onto render={<AlertDialog />}. Trigger opens it. Target gets { target }, the address being deleted. Confirm schedules the deletion with { pending, retryAfter }. Cancel closes, or undoes a scheduled deletion, with { scheduled }.
Props
2 documented props · Native <p> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | ((state: { target: string }) => ReactNode) | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Targetfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/target.tsx
DeleteAccount.PasswordRequiredgate
AddressInput and AddressLabel for the retyped address. PasswordRequired gates PasswordInput and PasswordLabel for an account that has a password.
Props
1 documented props
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
PasswordRequiredfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/password-required.tsx
DeleteAccount.Scheduledgate
Editing gates the fields before confirming; Scheduled gates the ten seconds after. Countdown is a polite status with { seconds }. Error gets { message }.
Required scope
DeleteAccount.Scheduled requires Root.
Props
1 documented props
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Scheduledfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/scheduled.tsx
DeleteAccount.Editinggate
Editing gates the fields before confirming; Scheduled gates the ten seconds after. Countdown is a polite status with { seconds }. Error gets { message }.
Required scope
DeleteAccount.Editing requires Root.
Props
1 documented props
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Editingfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/editing.tsx
DeleteAccount.Countdowncontent · <p>
Editing gates the fields before confirming; Scheduled gates the ten seconds after. Countdown is a polite status with { seconds }. Error gets { message }.
Required scope
DeleteAccount.Countdown requires Root.
Props
2 documented props · Native <p> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | ((state: { seconds: number }) => ReactNode) | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Countdownfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/countdown.tsx
DeleteAccount.Errorcontent · <p>
Editing gates the fields before confirming; Scheduled gates the ten seconds after. Countdown is a polite status with { seconds }. Error gets { message }.
Required scope
DeleteAccount.Error requires Root.
Props
2 documented props · Native <p> attributes supported
| Prop | Type | Default |
|---|---|---|
childrenContent rendered inside this part. | ReactNode | ((state: { message: string }) => ReactNode) | — |
renderReplace the default element with your own while retaining the part’s behavior and accessibility. | ReactElement | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
Errorfrom@slices.sh/auth/headless/delete-account
Source: @slices.sh/auth/src/headless/delete-account/error.tsx
User.Rootscope
Says which auth the User parts below read, and whether they may do without it. The parts need no root: left out, they read the nearest auth root's config, or "default", and render nothing without auth. `<User.Root enabled="optional">` is for the one who wants that said in the code.
Props
3 documented props
| Prop | Type | Default |
|---|---|---|
configThe auth config, a slug from the registry ( | string | — |
enabledLeft out or | Enabled | — |
childrenContent rendered inside this part. | ReactNode | — |
Required props are marked. A dash means no explicit default is declared in this component.
Alternate public imports
User.Rootfrom@slices.sh/auth/headless/userUser.Rootfrom@slices.sh/auth/headless/passkeysUser.Rootfrom@slices.sh/auth/headless/two-factor
Source: @slices.sh/auth/src/headless/user/root.tsx
When something is missing
- No service configuration
- Install the auth setup below and import "@/services". Required service roots report missing setup; gates do not replace that configuration.
- Missing capability or parent scope
- Follow each part’s context requirements and the example composition. Capability-aware controls hide when the provider cannot perform their action.