Skip to content
SLICES / TECHNICAL FOLIO Nº 001FULL-STACK ASSEMBLIES — OPEN SOURCE

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.

Behavior / inputGateGenericRenderer · not headlessScope
COMPONENT ANATOMYHover · focus · tap
ONE POSSIBLE DESIGNStatic preview

User.Root · Scope

User.RootSays 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.

Installation

Choose what your component needs. Run these commands in an initialized Next.js app.

0

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 nova

Or start fresh: the slices CLI creates the app and sets it up.

npx slices.sh install
1

Install 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 services
2

Install the headless library

npm

Add the React parts to your app, then compose them with your own elements.

npm install @slices.sh/auth@^0.1.10

Import from @slices.sh/auth/headless.

3

Install the service

Connect the parts to a provider. Skip this step if this service is already configured in your app.

Provider
Database
Authentication methods
Account capabilities
npx add auth.betterauth --auth-methods google

Adds 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.

example.tsx
"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

DeleteAccount.Root props
PropTypeDefault
config

The auth config, a slug from the registry (services/auth/<config>.config.ts). The nearest root's, else "default", when left out.

string—
enabled

Left out or true: required, and missing auth throws. "optional": renders its children and every part inside degrades without auth. false: off. A capability name such as "methods: password": requires auth with it.

Enabled—
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Root from @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

DeleteAccount.Available props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Available from @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

DeleteAccount.Dialog props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—
render

Replace 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
  • Dialog from @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

DeleteAccount.Trigger props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—
render

Replace 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
  • Trigger from @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

DeleteAccount.Cancel props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { scheduled: boolean }) => ReactNode)—
render

Replace 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
  • Cancel from @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

DeleteAccount.Confirm props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { pending: boolean; retryAfter: number }) => ReactNode)—
render

Replace 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
  • Confirm from @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

DeleteAccount.AddressInput props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—
render

Replace 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
  • AddressInput from @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

DeleteAccount.AddressLabel props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—
render

Replace 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
  • AddressLabel from @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

DeleteAccount.PasswordInput props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—
render

Replace 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
  • PasswordInput from @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

DeleteAccount.PasswordLabel props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—
render

Replace 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
  • PasswordLabel from @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

DeleteAccount.Target props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { target: string }) => ReactNode)—
render

Replace 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
  • Target from @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

DeleteAccount.PasswordRequired props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • PasswordRequired from @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

DeleteAccount.Scheduled props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Scheduled from @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

DeleteAccount.Editing props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Editing from @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

DeleteAccount.Countdown props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { seconds: number }) => ReactNode)—
render

Replace 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
  • Countdown from @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

DeleteAccount.Error props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { message: string }) => ReactNode)—
render

Replace 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
  • Error from @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

User.Root props
PropTypeDefault
config

The auth config, a slug from the registry (services/auth/<config>.config.ts). The nearest root's, else "default", when left out.

string—
enabled

Left out or true: required, and missing auth throws. "optional": renders its children and every part inside degrades without auth. false: off. A capability name such as "methods: password": requires auth with it.

Enabled—
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • User.Root from @slices.sh/auth/headless/user
  • User.Root from @slices.sh/auth/headless/passkeys
  • User.Root from @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.
Read the setup guide →