{
  "schemaVersion": 1,
  "target": "react",
  "name": "native-select",
  "version": "0.1.0",
  "category": "forms",
  "title": "Native Select",
  "description": "A native select styled like Input, with label, helper, and error text, for simple lists and phone pickers.",
  "tags": [
    "form",
    "select",
    "native",
    "mobile"
  ],
  "requires": {
    "projectTypes": [
      "next",
      "vite-react"
    ],
    "styling": "tailwind-v4"
  },
  "npmDependencies": {},
  "registryDependencies": [],
  "docsPath": "/components/native-select",
  "props": [
    {
      "name": "label",
      "type": "ReactNode",
      "description": "Visible label, linked to the select."
    },
    {
      "name": "description",
      "type": "ReactNode",
      "description": "Helper text, linked with aria-describedby."
    },
    {
      "name": "error",
      "type": "ReactNode",
      "description": "Error message. Sets aria-invalid and replaces the description."
    },
    {
      "name": "size",
      "type": "\"sm\" | \"md\"",
      "default": "\"md\"",
      "description": "32px or 36px tall."
    },
    {
      "name": "containerClassName",
      "type": "string",
      "description": "Classes for the wrapper. className styles the select."
    },
    {
      "name": "...props",
      "type": "ComponentProps<\"select\">",
      "description": "Any native select attribute; pass <option> and <optgroup> children."
    }
  ],
  "accessibility": [
    "Renders a native <select>, so keyboard, typeahead, and screen reader behavior come from the browser.",
    "The label is bound with htmlFor; helper and error text are linked with aria-describedby, and errors set aria-invalid.",
    "In dark mode the select sets color-scheme: dark, so the system option list opens dark.",
    "The chevron is decorative and ignores pointer events, so clicks reach the select."
  ],
  "states": [
    "default",
    "hover",
    "focus-visible",
    "invalid",
    "disabled"
  ],
  "files": [
    {
      "path": "ui/native-select.tsx",
      "content": "import { type ComponentProps, type ReactNode, useId } from \"react\";\n\nfunction cx(...classes: (string | false | null | undefined)[]) {\n  return classes.filter(Boolean).join(\" \");\n}\n\nconst sizes = {\n  sm: \"h-8 pr-8 pl-2.5\",\n  md: \"h-9 pr-9 pl-3\",\n} as const;\n\nexport interface NativeSelectProps extends Omit<ComponentProps<\"select\">, \"size\"> {\n  /** Visible label. Pass `aria-label` instead when the label is shown elsewhere. */\n  label?: ReactNode;\n  /** Helper text below the field. */\n  description?: ReactNode;\n  /** Error message. Marks the field invalid and replaces the description. */\n  error?: ReactNode;\n  /** Matches the Input height at `md`; `sm` for toolbars and dense forms. */\n  size?: keyof typeof sizes;\n  /** Classes for the wrapping element. `className` styles the select itself. */\n  containerClassName?: string;\n}\n\n/**\n * A native `<select>` styled like Input. The browser draws the option list, so it works with\n * no JavaScript, opens the system picker on phones, and suits short, simple lists. Pass\n * `<option>` and `<optgroup>` children as usual. For icons, groups with custom rows, or a\n * styled list, use Select.\n */\nexport function NativeSelect({\n  label,\n  description,\n  error,\n  size = \"md\",\n  id,\n  className,\n  containerClassName,\n  disabled,\n  \"aria-describedby\": describedBy,\n  children,\n  ...props\n}: NativeSelectProps) {\n  const generatedId = useId();\n  const selectId = id ?? generatedId;\n  const messageId = `${selectId}-message`;\n  const invalid = error != null && error !== false;\n  const message = invalid ? error : description;\n\n  return (\n    <div className={cx(\"grid gap-1.5\", containerClassName)}>\n      {label ? (\n        <label htmlFor={selectId} className=\"text-sm leading-5 font-medium text-zinc-950 dark:text-white\">\n          {label}\n        </label>\n      ) : null}\n      <div className=\"group/select relative\">\n        <select\n          id={selectId}\n          disabled={disabled}\n          aria-invalid={invalid || undefined}\n          aria-describedby={cx(message ? messageId : null, describedBy) || undefined}\n          className={cx(\n            \"w-full min-w-0 appearance-none truncate rounded-lg border bg-white text-sm text-zinc-900 shadow-sm\",\n            sizes[size],\n            \"transition-[border-color,box-shadow] duration-150 ease-out motion-reduce:transition-none\",\n            \"hover:border-zinc-400 dark:hover:border-zinc-600\",\n            \"focus-visible:border-sky-500 focus-visible:ring-3 focus-visible:ring-sky-500/20 focus-visible:outline-none\",\n            \"disabled:cursor-not-allowed disabled:bg-zinc-50 disabled:opacity-60\",\n            // The system option list follows the theme instead of opening white on a black page.\n            \"dark:bg-zinc-950 dark:text-zinc-100 dark:scheme-dark dark:disabled:bg-zinc-900\",\n            invalid\n              ? \"border-red-400 hover:border-red-400 focus-visible:border-red-500 focus-visible:ring-red-500/20 dark:border-red-500/60 dark:hover:border-red-500/60\"\n              : \"border-zinc-300 dark:border-zinc-700\",\n            className,\n          )}\n          {...props}\n        >\n          {children}\n        </select>\n        <svg\n          aria-hidden=\"true\"\n          viewBox=\"0 0 16 16\"\n          fill=\"none\"\n          className={cx(\n            \"pointer-events-none absolute top-1/2 size-4 -translate-y-1/2 text-zinc-400 dark:text-zinc-500\",\n            \"transition-colors duration-150 group-hover/select:text-zinc-600 motion-reduce:transition-none dark:group-hover/select:text-zinc-300\",\n            size === \"sm\" ? \"right-2\" : \"right-2.5\",\n          )}\n        >\n          <path d=\"M4.5 6.25L8 9.75l3.5-3.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n        </svg>\n      </div>\n      {message ? (\n        <p id={messageId} className={invalid ? \"text-sm text-red-600 dark:text-red-400\" : \"text-sm text-zinc-500 dark:text-zinc-400\"}>\n          {message}\n        </p>\n      ) : null}\n    </div>\n  );\n}\n"
    }
  ],
  "example": {
    "content": "import { NativeSelect } from \"@/components/shaken/ui/native-select\";\n\nexport default function NativeSelectExample() {\n  return (\n    <form className=\"grid w-full max-w-xs gap-5\">\n      <NativeSelect label=\"Timezone\" defaultValue=\"Europe/Berlin\" description=\"Schedules and digests use this timezone.\">\n        <optgroup label=\"Europe\">\n          <option value=\"Europe/London\">London (GMT+0)</option>\n          <option value=\"Europe/Berlin\">Berlin (GMT+1)</option>\n          <option value=\"Europe/Istanbul\">Istanbul (GMT+3)</option>\n        </optgroup>\n        <optgroup label=\"Americas\">\n          <option value=\"America/New_York\">New York (GMT-5)</option>\n          <option value=\"America/Los_Angeles\">Los Angeles (GMT-8)</option>\n        </optgroup>\n      </NativeSelect>\n      <NativeSelect label=\"Retention\" defaultValue=\"\" error=\"Choose how long to keep run logs.\">\n        <option value=\"\" disabled>\n          Select a period\n        </option>\n        <option value=\"7\">7 days</option>\n        <option value=\"30\">30 days</option>\n        <option value=\"90\">90 days</option>\n      </NativeSelect>\n      <NativeSelect aria-label=\"Rows per page\" size=\"sm\" defaultValue=\"25\" containerClassName=\"w-28\">\n        <option value=\"10\">10 rows</option>\n        <option value=\"25\">25 rows</option>\n        <option value=\"50\">50 rows</option>\n      </NativeSelect>\n    </form>\n  );\n}\n"
  }
}
