{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "select", "title": "Select", "description": "A neumorphic select/dropdown component.", "dependencies": [ "@base-ui/react", "@phosphor-icons/react", "class-variance-authority" ], "registryDependencies": ["utils"], "files": [ { "path": "src/components/ui/select.tsx", "content": "\"use client\";\n\nimport { Select as BaseSelect } from \"@base-ui/react/select\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { CaretUpDown, Check } from \"@phosphor-icons/react\";\nimport * as React from \"react\";\nimport { type ComponentProps, createContext, useContext } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nconst selectTriggerVariants = cva(\n [\n \"flex w-full items-center justify-between bg-surface shadow-neu-sm transition-all outline-none cursor-pointer\",\n \"data-[popup-open]:shadow-neu-pressed-sm\",\n \"data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed\",\n \"focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2\",\n ],\n {\n variants: {\n size: {\n sm: \"h-8 px-3 text-sm rounded-lg\",\n md: \"h-10 px-4 text-base rounded-xl\",\n lg: \"h-12 px-5 text-lg rounded-xl\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n },\n);\n\ntype SelectSize = \"sm\" | \"md\" | \"lg\";\n\ntype SelectItemType = { value: string | null; label: string };\n\nconst SelectContext = createContext<{\n size: SelectSize;\n}>({\n size: \"md\",\n});\n\ntype SelectProps = ComponentProps &\n VariantProps & {\n items?: SelectItemType[];\n };\n\nfunction Select({ size = \"md\", children, items, ...props }: SelectProps) {\n return (\n \n \n {children}\n \n \n );\n}\n\nfunction SelectTrigger({\n className,\n children,\n ...props\n}: ComponentProps) {\n const { size } = useContext(SelectContext);\n\n return (\n \n {children}\n \n \n \n \n );\n}\n\nconst SelectValue = BaseSelect.Value;\n\nfunction SelectContent({\n className,\n children,\n ...props\n}: ComponentProps) {\n return (\n \n \n \n {children}\n \n \n \n );\n}\n\ntype SelectItemProps = ComponentProps & {\n children: React.ReactNode;\n label?: string;\n};\n\nfunction SelectItem({\n className,\n children,\n label,\n value,\n ...props\n}: SelectItemProps) {\n return (\n \n {children}\n \n \n \n \n );\n}\n\nexport {\n Select,\n SelectTrigger,\n SelectValue,\n SelectContent,\n SelectItem,\n selectTriggerVariants,\n};\nexport type { SelectProps, SelectItemProps };\n", "type": "registry:ui" } ], "type": "registry:ui" }