Updated
Account Switcher
ProCustomize
Size36px
Peek2
Installation
ProAccount Switcher is a Pro component
Sign in to see the source, or install it with a license key. The live preview and props above are free to explore.
Install with a key
- Add the Pro registry to
components.json:components.json { "registries": { "@uibrik-pro": { "url": "https://uibrik.com/r/pro/{name}.json", "headers": { "Authorization": "Bearer ${UIBRIK_LICENSE}" } } } } - Put your key in
.env.localand add that file to.gitignore:.env.local UIBRIK_LICENSE=your-license-key - Install it:
Terminal npx shadcn@latest add @uibrik-pro/account-switcher
Loading your installation…
Usage
import { AccountSwitcher } from "@/components/uibrik/account-switcher/account-switcher";const accounts = [ { id: "nina", name: "Nina Park", detail: "nina@northwind.co", src: "/registry/account-switcher/nina.webp" }, { id: "felix", name: "Felix Brandt", detail: "felix@studio-oak.com", src: "/registry/account-switcher/felix.webp" }, // …1 more];<AccountSwitcher accounts={accounts} size={36} peek={2} addLabel="Add account" addForm addPlaceholder="name@company.com" onAdd={(email) => {}} // value="…" // onValueChange={(id, account) => {}} // open={false} // onOpenChange={(open) => {}}/>Where to use Account Switcher
Multi-account apps
The faces peeking behind the active one show there are other accounts before anyone opens the menu.
Pairs with Dropdown Menu
Workspace and team switching
The new face moves to the front and the name rolls over, so it's obvious the whole app just changed context.
Pairs with Collapsible Sidebar
Shared devices
Each person is a face, not just an email, so picking yourself on a family or kiosk device is quick.
Pairs with Presence Dot
Props
AccountSwitcher- size
- Type number
- 36
- Avatar diameter in the trigger.
- peek
- Type number
- 2
- Accounts peeking out behind the active one.
- addLabel
- Type string
- "Add account"
- Label of the add row.
- accountsrequired
- Type { id; name; detail?; src? }[]
- –
- Accounts in menu order. detail is the second line, such as an email.
- value / onValueChange
- Type string / (id, account) => void
- –
- Controlled active account. defaultValue for uncontrolled; defaults to the first.
- open / onOpenChange
- Type boolean / (open) => void
- –
- Controlled menu state.
- onAdd
- Type (email) => void | Promise
- –
- Adds an Add account row. It opens into an email field and gets the address; a promise shows a spinner until it settles, and a rejection marks the field.
- addForm
- Type boolean
- true
- Ask for the email in the menu. Off, the row calls onAdd("") straight away, e.g. to open your own sign-in.
- addPlaceholder
- Type string
- "name@company.com"
- Placeholder of the email field.
- className
- Type string
- –
- Classes for the wrapper.