{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "select", "title": "Select", "description": "Menu-picker select built on Popover + Command (no search input). Reuses the floating container, arrow-key navigation and inversion. Trigger uses ▾ glyph.", "registryDependencies": [ "utils", "popover", "command", "button", "theme-catppuccin-mocha", "font-jetbrains-mono" ], "files": [ { "path": "registry/ui/select.tsx", "content": "import * as React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n\tCommand,\n\tCommandEmpty,\n\tCommandGroup,\n\tCommandItem,\n\tCommandList,\n} from \"@/components/ui/command\";\nimport {\n\tPopover,\n\tPopoverContent,\n\tPopoverTrigger,\n} from \"@/components/ui/popover\";\nimport { cn } from \"@/lib/utils\";\n\ninterface SelectOption {\n\tvalue: string;\n\tlabel: string;\n\tdisabled?: boolean;\n}\n\ninterface SelectProps {\n\toptions: SelectOption[];\n\tvalue?: string;\n\tonValueChange?: (value: string) => void;\n\tplaceholder?: string;\n\temptyText?: string;\n\tclassName?: string;\n\tdisabled?: boolean;\n}\n\n/**\n * Menu-picker select (tmux choose-tree / ranger style) built on Popover +\n * Command. It reuses the same floating container as Combobox but omits the\n * search input — selection is by arrow keys with Vim-style inversion.\n */\nfunction Select({\n\toptions,\n\tvalue,\n\tonValueChange,\n\tplaceholder = \"select...\",\n\temptyText = \"-- empty --\",\n\tclassName,\n\tdisabled,\n}: SelectProps) {\n\tconst [open, setOpen] = React.useState(false);\n\tconst selected = options.find((option) => option.value === value);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{selected ? selected.label : placeholder}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t▾\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{emptyText}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{options.map((option) => {\n\t\t\t\t\t\t\t\tconst isSelected = option.value === value;\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t\t\tonValueChange?.(current);\n\t\t\t\t\t\t\t\t\t\t\tsetOpen(false);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t✓\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n}\n\nexport { Select };\nexport type { SelectOption, SelectProps };\n", "type": "registry:ui" } ], "type": "registry:ui" }