Account Settings
better-auth-ui/account-settingsFreeComponent
A container component that displays account settings including user profile, change email, and plugin-contributed account cards (e.g. appearance from the theme plugin, multi-session accounts).
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/account-settings.jsonSource
1"use client"23import { useAuth } from "@better-auth-ui/react"4import type { ComponentProps } from "react"56import { cn } from "@/lib/utils"7import { ChangeEmail } from "./change-email"8import { UserProfile } from "./user-profile"910export type AccountSettingsProps = {11 className?: string12}1314/**15 * Renders the account settings layout.16 *17 * Uses `emailAndPassword` and `plugins` from `useAuth()` to conditionally18 * show sections:19 * - `UserProfile` always renders.20 * - The change-email card renders when `emailAndPassword?.enabled` is truthy21 * or the `magicLink` plugin is registered, and a plugin may replace it via22 * `cardOverrides.account.changeEmail` (the email-OTP plugin swaps in its23 * code-based flow).24 * - Plugin-contributed account cards are rendered via the plugins array25 * (e.g. `Appearance` from the theme plugin, multi-session accounts).26 */27export function AccountSettings({28 className,29 ...props30}: AccountSettingsProps & ComponentProps<"div">) {31 const { emailAndPassword, plugins } = useAuth()3233 const hasMagicLink = plugins.some((plugin) => plugin.id === "magicLink")3435 const ChangeEmailOverride = plugins.find(36 (plugin) => plugin.cardOverrides?.account?.changeEmail37 )?.cardOverrides?.account?.changeEmail38 const ChangeEmailCard = ChangeEmailOverride ?? ChangeEmail3940 // A plugin that replaces the card brings its own way to confirm the change,41 // so it can stand on its own without password or magic-link auth.42 const showChangeEmail =43 emailAndPassword?.enabled || hasMagicLink || Boolean(ChangeEmailOverride)4445 return (46 <div47 className={cn("flex w-full flex-col gap-4 md:gap-6", className)}48 {...props}49 >50 <UserProfile />51 {showChangeEmail && <ChangeEmailCard />}52 {plugins.flatMap(53 (plugin) =>54 plugin.accountCards?.map((Card, index) => (55 <Card key={`${plugin.id}-${index.toString()}`} />56 )) ?? []57 )}58 </div>59 )60}
What it pulls in
npm packages
Other registry items
Files it writes
More from better-auth-ui
All 49 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Active Sessionsactive-sessions | better-auth-ui | Components | Free | 5 deps · 2 files | |
| Additional Fieldadditional-field | better-auth-ui | Components | Free | 5 deps | |
| Adminadmin | better-auth-ui | Components | Free | 4 deps · 3 files | |
| Anonymousanonymous | better-auth-ui | Components | Free | 4 deps · 3 files | |
| API Keyapi-key | better-auth-ui | Components | Free | 4 deps · 10 files | |
| Authauth | better-auth-ui | Components | Free | 2 deps | |
| Auth Providerauth-provider | better-auth-ui | Components | Free | 4 deps · 2 files | |
| Auth Redirectauth-redirect | better-auth-ui | Components | Free | 3 deps |
