BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ilinxa/account-switcher

Account Switcher

ilinxa/account-switcher
FreeBlock

Popover account and context switcher — active label trigger, switchable context list, and a footer slot for create or request actions.

Install it

npx shadcn@latest add https://ui.ilinxa.com/r/account-switcher.json

Source

src/registry/components/navigation/account-switcher/account-switcher.tsxui.ilinxa.com/r/account-switcher.json
1"use client";
2
3import { useCallback, useId, useMemo } from "react";
4import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
5import { Separator } from "@/components/ui/separator";
6import { cn } from "@/lib/utils";
7import { useControllableState } from "./hooks/use-controllable-state";
8import { enforceUniqueKeys } from "./lib/enforce-unique-keys";
9import { resolveActiveItem } from "./lib/resolve-active-item";
10import { EmptyPlaceholder } from "./parts/empty-placeholder";
11import { SwitcherItemRow } from "./parts/switcher-item-row";
12import {
13 SwitcherTriggerContent,
14 composeSwitcherTriggerAriaLabel,
15 switcherTriggerClassName,
16} from "./parts/switcher-trigger";
17import type { AccountSwitcherProps, SwitcherItem } from "./types";
18
19const DEFAULT_ARIA_LABEL = "Switch account context";
20
21/**
22 * Account Switcher — popover-with-switchable-items primitive.
23 *
24 * See [`docs/procomps/account-switcher-procomp/`](../../../../../docs/procomps/account-switcher-procomp/)
25 * for description + plan + guide. Locks L1–L14, all PQs at default per
26 * 2026-05-23 GATE 2 close.
27 */
28export function AccountSwitcher(props: AccountSwitcherProps) {
29 const {
30 items,
31 activeKey,
32 onSelect,
33 fallbackActiveItem,
34 footerSlot,
35 isCollapsed = false,
36 collapsedPopoverSide = "right",
37 "aria-label": ariaLabel = DEFAULT_ARIA_LABEL,
38 ariaCurrent = "true",
39 open: openProp,
40 defaultOpen,
41 onOpenChange,
42 className,
43 } = props;
44
45 const listboxId = useId();
46
47 const [open, setOpen] = useControllableState<boolean>({
48 value: openProp,
49 defaultValue: defaultOpen ?? false,
50 onChange: onOpenChange,
51 componentName: "account-switcher",
52 valuePropName: "open",
53 });
54
55 // L3 + Q2 — dev-warn + strip duplicates once per items reference change.
56 const dedupedItems = useMemo(() => enforceUniqueKeys(items), [items]);
57
58 const activeResolution = useMemo(
59 () => resolveActiveItem(dedupedItems, activeKey, fallbackActiveItem),
60 [dedupedItems, activeKey, fallbackActiveItem],
61 );
62
63 const activeItem = activeResolution.kind === "empty" ? null : activeResolution.item;
64
65 // F-cross-13 guard at the shadcn-primitive boundary. The consumer's
66 // `onOpenChange` is shielded — `useControllableState` always calls it with
67 // the validated `boolean`. Plan §10.
68 const handlePrimitiveOpenChange = useCallback(
69 (next: unknown) => {
70 if (typeof next !== "boolean") return;
71 setOpen(next);
72 },
73 [setOpen],
74 );
75
76// … truncated

What it pulls in

npm packages

  • lucide-react

Other registry items

  • popover
  • separator

Files it writes

  • src/registry/components/navigation/account-switcher/account-switcher.tsx
  • src/registry/components/navigation/account-switcher/index.ts
  • src/registry/components/navigation/account-switcher/types.ts
  • src/registry/components/navigation/account-switcher/hooks/use-controllable-state.ts
  • src/registry/components/navigation/account-switcher/lib/enforce-unique-keys.ts
  • src/registry/components/navigation/account-switcher/lib/resolve-active-item.ts
  • src/registry/components/navigation/account-switcher/parts/empty-placeholder.tsx
  • src/registry/components/navigation/account-switcher/parts/render-icon.tsx
  • src/registry/components/navigation/account-switcher/parts/switcher-item-row.tsx
  • src/registry/components/navigation/account-switcher/parts/switcher-trigger.tsx

Facts

Registry
ilinxa
Type
registry:block
Access
Free
Files written
10
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
yesterday

Go to the source

ui.ilinxa.com ilinxa/pro-ui on GitHub Raw registry item This item as JSON

More from ilinxa

All 184 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Account Switcher (deprecated alias)account-switcher-01ilinxaBlocksFreeno deps
Account Switcher — fixturesaccount-switcher-fixturesilinxaBlocksFreeno deps
App Sidebarapp-sidebarilinxaBlocksFree1 dep · 37 files
App Sidebar — fixturesapp-sidebar-fixturesilinxaBlocksFreeno deps
Rich Text Editor (deprecated alias)article-body-01ilinxaBlocksFreeno deps
Article Metaarticle-metailinxaBlocksFree1 dep · 4 files
Article Meta (deprecated alias)article-meta-01ilinxaBlocksFreeno deps
Article Meta — fixturesarticle-meta-fixturesilinxaBlocksFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex