{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "profile-selector", "type": "registry:ui", "title": "Profile Selector", "description": "An interactive component for selecting a user profile from a list.", "files": [ { "path": "registry/new-york/ui/profile-selector.tsx", "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\ninterface ProfileSelectorProps {\n profiles: { name: string; image: string }[];\n defaultSelected?: number;\n onSelect?: (profile: { name: string; image: string }) => void;\n className?: string;\n}\n\nfunction ProfileSelector({\n profiles,\n defaultSelected = 0,\n onSelect,\n className,\n}: ProfileSelectorProps) {\n const safeIndex = defaultSelected < profiles.length ? defaultSelected : 0;\n const [selected, setSelected] = React.useState(profiles[safeIndex]);\n\n const handleSelect = (profile: { name: string; image: string }) => {\n setSelected(profile);\n onSelect?.(profile);\n };\n\n return (\n
\n {/* Selected Profile Display */}\n
\n
\n \n
\n

{selected.name}

\n
\n\n {/* Profile List */}\n \n {profiles.map((profile) => (\n handleSelect(profile)}\n />\n ))}\n
\n \n );\n}\n\nfunction ProfileItem({\n name,\n image,\n isSelected,\n onSelect,\n}: {\n name: string;\n image: string;\n isSelected: boolean;\n onSelect: () => void;\n}) {\n return (\n \n
\n \n
\n

{name}

\n \n );\n}\n\nexport { ProfileSelector, ProfileItem };\n", "type": "registry:ui" } ] }