{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "multiple-accounts-shadcnui", "type": "registry:component", "title": "Multiple Accounts Switcher", "description": "Glassmorphic account switcher with animated dropdown and accessible listbox controls", "registryDependencies": [ "button" ], "dependencies": [ "framer-motion", "react" ], "files": [ { "path": "@uitripled/react-shadcn/src/components/components/account-switcher/multiple-accounts.tsx", "content": "\"use client\";\n\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport { Check, ChevronDown, LogOut } from \"lucide-react\";\nimport { useId, useMemo, useState } from \"react\";\n\ntype Account = {\n id: string;\n name: string;\n email: string;\n avatarUrl: string;\n plan: \"Free\" | \"Pro\" | \"Enterprise\";\n};\n\nconst accountOptions: Account[] = [\n {\n id: \"nova-studio\",\n name: \"Nova Studio\",\n email: \"finance@tripled.work\",\n avatarUrl:\n \"https://iimydr2b8o.ufs.sh/f/Zqn6AViLMoTtHnKrXgkK7FlZGQ2nWi4Jzv0TXU9DVkAd5yE1\",\n plan: \"Pro\",\n },\n {\n id: \"growth-lab\",\n name: \"Growth Lab\",\n email: \"ops@tripled.work\",\n avatarUrl:\n \"https://iimydr2b8o.ufs.sh/f/Zqn6AViLMoTtIYuGoisEhfWHMxKLVXD5ouFcBtgk6enZS0OG\",\n plan: \"Enterprise\",\n },\n {\n id: \"personal-workspace\",\n name: \"Personal Workspace\",\n email: \"morgan@tripled.work\",\n avatarUrl:\n \"https://iimydr2b8o.ufs.sh/f/Zqn6AViLMoTtqpB1uxNk0UapbrAxOtRg9jDGu8sZzWLf2VM1\",\n plan: \"Free\",\n },\n];\n\nexport function MultipleAccounts() {\n const shouldReduceMotion = useReducedMotion();\n const [activeId, setActiveId] = useState(accountOptions[0]?.id ?? \"\");\n const [isOpen, setIsOpen] = useState(false);\n const listboxId = useId();\n\n const activeAccount = useMemo(\n () =>\n accountOptions.find((account) => account.id === activeId) ??\n accountOptions[0],\n [activeId]\n );\n\n const statusMessage = activeAccount\n ? `${activeAccount.name} selected. Plan ${activeAccount.plan}.`\n : \"No account selected.\";\n\n return (\n \n setIsOpen((previous) => !previous)}\n >\n \n \n \n
\n \n {activeAccount?.name}\n \n \n {activeAccount?.email}\n \n
\n \n \n \n \n\n \n {isOpen && (\n \n {accountOptions.map((account, index) => (\n {\n setActiveId(account.id);\n setIsOpen(false);\n }}\n initial={{\n opacity: shouldReduceMotion ? 1 : 0,\n x: shouldReduceMotion ? 0 : -8,\n }}\n animate={{ opacity: 1, x: 0 }}\n transition={\n shouldReduceMotion\n ? { duration: 0 }\n : { delay: 0.04 * index, duration: 0.24, ease: \"easeOut\" }\n }\n >\n \n \n \n
\n \n {account.name}\n \n \n {account.email}\n \n
\n \n {account.plan}\n \n {account.id === activeId && (\n \n \n \n )}\n \n ))}\n\n
\n
\n \n Manage accounts\n
\n \n Settings\n \n
\n \n )}\n
\n\n \n {statusMessage}\n \n \n );\n}\n", "type": "registry:component", "target": "components/uitripled/multiple-accounts-shadcnui.tsx" } ] }