{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select",
  "type": "registry:ui",
  "title": "Select",
  "description": "A dropdown for picking one option from a list. Put it inside a Field for the label and errors.",
  "dependencies": [
    "lucide-react@^1.48.0",
    "radix-ui@^1.6.7"
  ],
  "registryDependencies": [
    "https://blank.vageshwar.dev/r/theme.json",
    "https://blank.vageshwar.dev/r/field.json",
    "https://blank.vageshwar.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "ui/select.tsx",
      "type": "registry:ui",
      "content": "// BlankUI: select. Managed by BlankUI. Read select.md before editing. Wrap in <Field> for label and errors.\nimport type { ComponentProps } from \"react\"\nimport { Select as SelectPrimitive } from \"radix-ui\"\nimport { Check, ChevronDown } from \"lucide-react\"\nimport { useFieldControl } from \"@/components/ui/field\"\nimport { cn } from \"@/lib/utils\"\n\n/**\n * A dropdown to pick one option. Use `value` and `onValueChange`.\n *\n * @example\n * <Field label=\"Country\">\n *   <Select value={country} onValueChange={setCountry}>\n *     <SelectTrigger>\n *       <SelectValue placeholder=\"Pick a country\" />\n *     </SelectTrigger>\n *     <SelectContent>\n *       <SelectItem value=\"in\">India</SelectItem>\n *       <SelectItem value=\"us\">United States</SelectItem>\n *     </SelectContent>\n *   </Select>\n * </Field>\n */\nexport function Select(props: ComponentProps<typeof SelectPrimitive.Root>) {\n  return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\n/** Groups items under a SelectLabel. */\nexport function SelectGroup(props: ComponentProps<typeof SelectPrimitive.Group>) {\n  return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />\n}\n\n/** Shows the selected item, or the placeholder. */\nexport function SelectValue(props: ComponentProps<typeof SelectPrimitive.Value>) {\n  return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nexport interface SelectTriggerProps extends ComponentProps<typeof SelectPrimitive.Trigger> {\n  /** Height. Defaults to `default`. */\n  size?: \"sm\" | \"default\"\n}\n\n/** The button that opens the list. Reads its id and error state from <Field>. */\nexport function SelectTrigger({\n  className,\n  size = \"default\",\n  children,\n  ...props\n}: SelectTriggerProps) {\n  // A button has no `required` attribute, so Field's required state becomes aria-required.\n  const { required, ...wired } = useFieldControl<SelectTriggerProps & { required?: boolean }>(props)\n  return (\n    <SelectPrimitive.Trigger\n      aria-required={required || undefined}\n      data-slot=\"select-trigger\"\n      className={cn(\n        \"flex w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-surface px-3 text-sm whitespace-nowrap text-foreground shadow-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive data-[placeholder]:text-muted-foreground [&>span]:truncate\",\n        size === \"sm\" ? \"h-8\" : \"h-10\",\n        className,\n      )}\n      {...wired}\n    >\n      {children}\n      <SelectPrimitive.Icon asChild>\n        <ChevronDown className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n      </SelectPrimitive.Icon>\n    </SelectPrimitive.Trigger>\n  )\n}\n\n/** The floating list of items. */\nexport function SelectContent({\n  className,\n  children,\n  position = \"popper\",\n  ...props\n}: ComponentProps<typeof SelectPrimitive.Content>) {\n  return (\n    <SelectPrimitive.Portal>\n      <SelectPrimitive.Content\n        data-slot=\"select-content\"\n        position={position}\n        className={cn(\n          \"relative z-50 max-h-(--radix-select-content-available-height) min-w-32 overflow-hidden rounded-md border bg-surface-raised text-foreground shadow-md\",\n          position === \"popper\" &&\n            \"w-full min-w-(--radix-select-trigger-width) data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1\",\n          className,\n        )}\n        {...props}\n      >\n        <SelectPrimitive.Viewport className=\"p-1\">{children}</SelectPrimitive.Viewport>\n      </SelectPrimitive.Content>\n    </SelectPrimitive.Portal>\n  )\n}\n\n/** A heading for a SelectGroup. */\nexport function SelectLabel({ className, ...props }: ComponentProps<typeof SelectPrimitive.Label>) {\n  return (\n    <SelectPrimitive.Label\n      data-slot=\"select-label\"\n      className={cn(\"px-2 py-1.5 text-xs font-medium text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\n/** One option. `value` must be a non-empty string. */\nexport function SelectItem({\n  className,\n  children,\n  ...props\n}: ComponentProps<typeof SelectPrimitive.Item>) {\n  return (\n    <SelectPrimitive.Item\n      data-slot=\"select-item\"\n      className={cn(\n        \"relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-hover\",\n        className,\n      )}\n      {...props}\n    >\n      <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n      <span className=\"absolute right-2 flex size-4 items-center justify-center\">\n        <SelectPrimitive.ItemIndicator>\n          <Check className=\"size-4\" aria-hidden=\"true\" />\n        </SelectPrimitive.ItemIndicator>\n      </span>\n    </SelectPrimitive.Item>\n  )\n}\n\n/** A line between groups. */\nexport function SelectSeparator({\n  className,\n  ...props\n}: ComponentProps<typeof SelectPrimitive.Separator>) {\n  return (\n    <SelectPrimitive.Separator\n      data-slot=\"select-separator\"\n      className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n      {...props}\n    />\n  )\n}\n"
    },
    {
      "path": "ui/select.md",
      "type": "registry:ui",
      "content": "---\nname: select\ntitle: Select\ndescription: A dropdown for picking one option from a list. Put it inside a Field for the label and errors.\ncategory: form\nwhenToUse:\n  - Picking one option from a list of about 4 to 20 items.\nwhenNotToUse:\n  - when: Picking several options.\n    use: checkbox\n  - when: The list has only 2 or 3 options that should all be visible.\n    use: checkbox\n  - when: Showing a menu of actions.\n    use: popover\nrelated: [field, checkbox, input]\nrequiredParts: [Select, SelectTrigger, SelectValue, SelectContent, SelectItem]\nantiPatterns:\n  - avoid: \"<select><option>...</option></select> (a raw select element)\"\n    instead: \"<Select> with SelectTrigger, SelectValue, SelectContent and SelectItem\"\n  - avoid: \"onChange={(e) => setValue(e.target.value)}\"\n    instead: \"onValueChange={setValue}\"\n  - avoid: '<SelectItem value=\"\">None</SelectItem>'\n    instead: \"Leave the Select empty and use the SelectValue placeholder\"\n---\n\n# Select\n\nBuilt on Radix. Use `value` and `onValueChange` (or `defaultValue`). Item values must be non-empty strings.\n\n## Import\n\n```tsx\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/components/ui/select\"\n```\n\n## Example\n\n```tsx\n<Field label=\"Role\">\n  <Select value={role} onValueChange={setRole}>\n    <SelectTrigger>\n      <SelectValue placeholder=\"Pick a role\" />\n    </SelectTrigger>\n    <SelectContent>\n      <SelectItem value=\"admin\">Admin</SelectItem>\n      <SelectItem value=\"member\">Member</SelectItem>\n      <SelectItem value=\"viewer\">Viewer</SelectItem>\n    </SelectContent>\n  </Select>\n</Field>\n```\n\n## Groups\n\n```tsx\n<SelectContent>\n  <SelectGroup>\n    <SelectLabel>Fruits</SelectLabel>\n    <SelectItem value=\"apple\">Apple</SelectItem>\n  </SelectGroup>\n  <SelectSeparator />\n  <SelectGroup>\n    <SelectLabel>Vegetables</SelectLabel>\n    <SelectItem value=\"carrot\">Carrot</SelectItem>\n  </SelectGroup>\n</SelectContent>\n```\n\nPass `name` to `Select` to include the value in a native form submit.\n"
    }
  ],
  "docs": "Read components/ui/select.md before using Select. Docs: https://blank.vageshwar.dev/docs/select",
  "meta": {
    "category": "form",
    "requiredParts": [
      "Select",
      "SelectTrigger",
      "SelectValue",
      "SelectContent",
      "SelectItem"
    ],
    "related": [
      "field",
      "checkbox",
      "input"
    ]
  }
}
