Linked Accounts
better-auth-ui/linked-accountsFreeComponent
Display and manage linked social accounts. Shows all linked social accounts with the ability to unlink them, followed by available providers that can be linked.
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/linked-accounts.jsonSource
1"use client"23import { useAuth, useListAccounts } from "@better-auth-ui/react"4import { Fragment } from "react"5import { Card, CardContent } from "@/components/ui/card"6import {7 Item,8 ItemContent,9 ItemGroup,10 ItemMedia,11 ItemSeparator12} from "@/components/ui/item"13import { Skeleton } from "@/components/ui/skeleton"14import { cn } from "@/lib/utils"15import { LinkedAccount } from "./linked-account"1617export type LinkedAccountsProps = {18 className?: string19}2021/**22 * Render a card showing linked social accounts and available social providers to link.23 *24 * Linked accounts (excluding the "credential" provider) are shown with an unlink control;25 * available providers are shown with a link control. Button states and labels reflect26 * ongoing link/unlink activity and use localization for provider-specific text.27 *28 * @returns A JSX element containing the linked accounts card29 */30export function LinkedAccounts({ className }: LinkedAccountsProps) {31 const {32 authClient,33 localization,34 multipleAccountsPerProvider,35 socialProviders36 } = useAuth()3738 const { data: accounts, isPending } = useListAccounts(authClient)3940 const linkedAccounts = accounts?.filter(41 (account) => account.providerId !== "credential"42 )4344 const linkedProviderIds = new Set(linkedAccounts?.map((a) => a.providerId))4546 const availableProviders =47 multipleAccountsPerProvider === false48 ? socialProviders?.filter((p) => !linkedProviderIds.has(p))49 : socialProviders5051 const allRows = [52 ...(linkedAccounts?.map((account) => ({53 key: account.id,54 account,55 provider: account.providerId56 })) ?? []),57 ...(availableProviders?.map((provider) => ({58 key: provider,59 account: undefined,60 provider61 })) ?? [])62 ]6364 return (65 <div>66 <h2 className="text-sm font-semibold mb-3">67 {localization.settings.linkedAccounts}68 </h2>6970 <Card className={cn("p-0", className)}>71 <CardContent className="p-0">72 <ItemGroup className="gap-0">73 {isPending74 ? socialProviders?.map((provider, index) => (75 <Fragment key={provider}>76 {index > 0 && <ItemSeparator />}77 <AccountRowSkeleton />78 </Fragment>79 ))80 : allRows.map((row, index) => (81 <Fragment key={row.key}>82 {index > 0 && <ItemSeparator />}83 <LinkedAccount84// … truncated
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 |
|---|---|---|---|---|---|
| Account Settingsaccount-settings | better-auth-ui | Components | Free | 2 deps | |
| 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 |
