{
  "schemaVersion": 1,
  "target": "react",
  "name": "select",
  "version": "0.1.0",
  "category": "forms",
  "title": "Select",
  "description": "A styled Base UI Select with an Input-like trigger, groups, separators, item icons, and a check on the selected item.",
  "tags": [
    "form",
    "select",
    "listbox",
    "dropdown",
    "base-ui"
  ],
  "requires": {
    "projectTypes": [
      "next",
      "vite-react"
    ],
    "styling": "tailwind-v4"
  },
  "npmDependencies": {
    "@base-ui/react": "^1.9.0"
  },
  "registryDependencies": [],
  "docsPath": "/components/select",
  "props": [
    {
      "name": "items",
      "type": "{ value, label }[]",
      "description": "Select: lets the trigger show the selected value's label."
    },
    {
      "name": "value / defaultValue",
      "type": "Value",
      "description": "Select: the selected value."
    },
    {
      "name": "onValueChange",
      "type": "(value) => void",
      "description": "Select: called when the selection changes."
    },
    {
      "name": "multiple",
      "type": "boolean",
      "default": "false",
      "description": "Select: allow several values."
    },
    {
      "name": "placeholder",
      "type": "ReactNode",
      "description": "SelectTrigger: text shown before a choice is made."
    },
    {
      "name": "size",
      "type": "\"sm\" | \"md\"",
      "default": "\"md\"",
      "description": "SelectTrigger: 32px or 36px tall."
    },
    {
      "name": "alignItemWithTrigger",
      "type": "boolean",
      "default": "false",
      "description": "SelectContent: place the list over the trigger, aligned to the selected item."
    },
    {
      "name": "icon",
      "type": "ReactNode",
      "description": "SelectItem: a 16px icon before the text."
    }
  ],
  "accessibility": [
    "The trigger is a button with role=\"combobox\" and the list a role=\"listbox\" of role=\"option\" items, managed by Base UI.",
    "SelectLabel names the trigger; clicking it focuses the trigger without opening the list.",
    "Arrow keys move the highlight, typing jumps to a matching item, Enter or Space selects, Escape closes and returns focus to the trigger.",
    "The selected item carries a check mark as well as stronger text, so it does not rely on color.",
    "The list fades and scales from the trigger in 160ms; under reduced motion it appears without the transition."
  ],
  "states": [
    "closed",
    "open",
    "placeholder",
    "selected",
    "focus-visible",
    "invalid",
    "disabled"
  ],
  "files": [
    {
      "path": "ui/select.tsx",
      "content": "\"use client\";\n\nimport { Select as BaseSelect } from \"@base-ui/react/select\";\nimport type { ComponentProps, ReactNode } from \"react\";\n\ntype ClassName<State> = string | ((state: State) => string | undefined) | undefined;\n\nfunction cx(...classes: (string | false | null | undefined)[]) {\n  return classes.filter(Boolean).join(\" \");\n}\n\n/** Prepends base classes while keeping Base UI's state-function form of className working. */\nfunction withBase<State>(base: string, className: ClassName<State>) {\n  return typeof className === \"function\" ? (state: State) => cx(base, className(state)) : cx(base, className);\n}\n\n/**\n * Groups the select parts and holds its value. Pass `items` (an array of `{ value, label }`) so\n * the trigger can show the label of the selected value, plus `defaultValue` or `value` +\n * `onValueChange`. Add `multiple` to select several values.\n */\nexport const Select = BaseSelect.Root;\n\n/** A visible label for the trigger. Clicking it focuses the trigger without opening the list. */\nexport function SelectLabel({ className, ...props }: BaseSelect.Label.Props) {\n  return (\n    <BaseSelect.Label\n      className={withBase(\"text-sm leading-5 font-medium text-zinc-950 select-none dark:text-white\", className)}\n      {...props}\n    />\n  );\n}\n\nconst triggerSizes = {\n  sm: \"h-8 pr-1.5 pl-2.5\",\n  md: \"h-9 pr-2 pl-3\",\n} as const;\n\nexport interface SelectTriggerProps extends BaseSelect.Trigger.Props {\n  /** Text shown until a value is chosen. */\n  placeholder?: ReactNode;\n  /** Matches the Input height at `md`; `sm` for toolbars and dense forms. */\n  size?: keyof typeof triggerSizes;\n}\n\n/**\n * The button that opens the list, styled like Input. Shows the selected item's label, or the\n * placeholder in the tertiary color. Pass `children` to render the value yourself.\n */\nexport function SelectTrigger({ placeholder, size = \"md\", className, children, ...props }: SelectTriggerProps) {\n  return (\n    <BaseSelect.Trigger\n      className={withBase(\n        cx(\n          \"group/trigger inline-flex w-full min-w-0 cursor-default items-center justify-between gap-2 rounded-lg border text-left text-sm select-none\",\n          triggerSizes[size],\n          \"border-zinc-300 bg-white text-zinc-900 shadow-sm hover:border-zinc-400\",\n          \"dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100 dark:hover:border-zinc-600\",\n          \"data-[popup-open]:border-zinc-400 dark:data-[popup-open]:border-zinc-600\",\n          \"transition-[border-color,box-shadow] duration-150 ease-out motion-reduce:transition-none\",\n          \"focus-visible:border-sky-500 focus-visible:ring-3 focus-visible:ring-sky-500/20 focus-visible:outline-none\",\n          \"data-[invalid]:border-red-400 dark:data-[invalid]:border-red-500/60\",\n          \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60\",\n        ),\n        className,\n      )}\n      {...props}\n    >\n      {children ?? (\n        <BaseSelect.Value\n          placeholder={placeholder}\n          className=\"min-w-0 truncate data-[placeholder]:text-zinc-400 dark:data-[placeholder]:text-zinc-500\"\n        />\n      )}\n      <BaseSelect.Icon className=\"flex shrink-0 text-zinc-400 transition-colors duration-150 group-hover/trigger:text-zinc-600 motion-reduce:transition-none dark:text-zinc-500 dark:group-hover/trigger:text-zinc-300\">\n        <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" className=\"size-4\">\n          <path d=\"M5.5 6.25L8 3.75l2.5 2.5M5.5 9.75L8 12.25l2.5-2.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n        </svg>\n      </BaseSelect.Icon>\n    </BaseSelect.Trigger>\n  );\n}\n\ntype PositionerProps = BaseSelect.Positioner.Props;\n\nexport interface SelectContentProps extends BaseSelect.Popup.Props {\n  /**\n   * Places the list over the trigger so the selected item lines up with the trigger's text, as\n   * native menus do. Off by default: the list opens below the trigger like a dropdown menu.\n   */\n  alignItemWithTrigger?: PositionerProps[\"alignItemWithTrigger\"];\n  /** Side of the trigger to place the list on. Flips when there is not enough room. */\n  side?: PositionerProps[\"side\"];\n  /** Alignment against the trigger on the chosen side. */\n  align?: PositionerProps[\"align\"];\n  /** Gap between the trigger and the list, in pixels. */\n  sideOffset?: PositionerProps[\"sideOffset\"];\n  /** Classes for the positioner wrapper, for example to change the z-index. */\n  positionerClassName?: string;\n  /** Element to portal into. Defaults to `document.body`. */\n  container?: BaseSelect.Portal.Props[\"container\"];\n}\n\n/**\n * The list panel, rendered in a portal. It is at least as wide as the trigger and scrolls when\n * tall, with arrows at the edges for pointer users.\n */\nexport function SelectContent({\n  alignItemWithTrigger = false,\n  side = \"bottom\",\n  align = \"start\",\n  sideOffset = 6,\n  positionerClassName,\n  container,\n  className,\n  children,\n  ...props\n}: SelectContentProps) {\n  return (\n    <BaseSelect.Portal container={container}>\n      <BaseSelect.Positioner\n        alignItemWithTrigger={alignItemWithTrigger}\n        side={side}\n        align={align}\n        sideOffset={sideOffset}\n        className={cx(\"z-50 outline-none select-none\", positionerClassName)}\n      >\n        <BaseSelect.Popup\n          className={withBase(\n            cx(\n              \"relative max-w-(--available-width) min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden rounded-xl outline-none\",\n              \"border border-zinc-950/10 bg-white text-zinc-950 shadow-[0_12px_32px_-8px_rgb(0_0_0/0.18)]\",\n              \"dark:border-white/15 dark:bg-black dark:text-white dark:shadow-[0_16px_48px_-12px_rgb(0_0_0/1),inset_0_1px_0_rgb(255_255_255/0.08)]\",\n              // Enter: 160ms from 96% at the trigger. Exit: 110ms, fades with a smaller scale.\n              \"transition-[opacity,scale] duration-160 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none\",\n              \"data-[starting-style]:opacity-0 motion-safe:data-[starting-style]:scale-96\",\n              \"data-[ending-style]:opacity-0 data-[ending-style]:duration-110 data-[ending-style]:ease-out motion-safe:data-[ending-style]:scale-98\",\n              // Aligned over the trigger, the list only fades: growing from the trigger's middle reads as a jump.\n              \"data-[side=none]:data-[starting-style]:scale-100 data-[side=none]:data-[ending-style]:scale-100\",\n            ),\n            className,\n          )}\n          {...props}\n        >\n          <SelectScrollArrow direction=\"up\" />\n          <BaseSelect.List className=\"max-h-[min(var(--available-height),22rem)] scroll-py-1.5 overflow-y-auto overscroll-contain p-1.5 outline-none\">\n            {children}\n          </BaseSelect.List>\n          <SelectScrollArrow direction=\"down\" />\n        </BaseSelect.Popup>\n      </BaseSelect.Positioner>\n    </BaseSelect.Portal>\n  );\n}\n\nfunction SelectScrollArrow({ direction }: { direction: \"up\" | \"down\" }) {\n  const Arrow = direction === \"up\" ? BaseSelect.ScrollUpArrow : BaseSelect.ScrollDownArrow;\n  return (\n    <Arrow\n      className={cx(\n        \"absolute inset-x-0 z-10 flex h-6 cursor-default items-center justify-center text-zinc-400 dark:text-zinc-500\",\n        direction === \"up\"\n          ? \"top-0 bg-linear-to-b from-white from-50% to-transparent dark:from-black\"\n          : \"bottom-0 bg-linear-to-t from-white from-50% to-transparent dark:from-black\",\n      )}\n    >\n      <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" className={cx(\"size-3.5\", direction === \"down\" && \"rotate-180\")}>\n        <path d=\"M4.5 10L8 6.5l3.5 3.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n      </svg>\n    </Arrow>\n  );\n}\n\nexport interface SelectItemProps extends BaseSelect.Item.Props {\n  /** A 16px icon before the text. */\n  icon?: ReactNode;\n}\n\n/**\n * An option. The selected one carries a check at the end. The highlight follows the pointer\n * and arrow keys instantly; lists are used too often to animate it.\n */\nexport function SelectItem({ icon, className, children, ...props }: SelectItemProps) {\n  return (\n    <BaseSelect.Item\n      className={withBase(\n        cx(\n          \"relative flex h-8 cursor-default items-center gap-2.5 rounded-md pr-8 pl-2 text-sm outline-none select-none\",\n          \"text-zinc-700 data-[highlighted]:bg-zinc-950/[0.05] data-[highlighted]:text-zinc-950\",\n          \"dark:text-zinc-300 dark:data-[highlighted]:bg-white/[0.08] dark:data-[highlighted]:text-white\",\n          \"data-[selected]:text-zinc-950 dark:data-[selected]:text-white\",\n          \"data-[disabled]:pointer-events-none data-[disabled]:opacity-45\",\n          \"[&_svg]:size-4 [&_svg]:shrink-0\",\n        ),\n        className,\n      )}\n      {...props}\n    >\n      {icon != null ? (\n        <span aria-hidden=\"true\" className=\"flex text-zinc-500 in-data-[highlighted]:text-zinc-950 dark:text-zinc-500 dark:in-data-[highlighted]:text-white\">\n          {icon}\n        </span>\n      ) : null}\n      <BaseSelect.ItemText className=\"min-w-0 flex-1 truncate\">{children}</BaseSelect.ItemText>\n      <BaseSelect.ItemIndicator className=\"absolute right-2 flex text-zinc-950 dark:text-white\">\n        <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\">\n          <path d=\"M3.75 8.25l2.75 2.75 5.75-6\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n        </svg>\n      </BaseSelect.ItemIndicator>\n    </BaseSelect.Item>\n  );\n}\n\n/** Groups related options. Put a SelectGroupLabel inside to name the group. */\nexport function SelectGroup({ className, ...props }: BaseSelect.Group.Props) {\n  return <BaseSelect.Group className={withBase(\"not-first:mt-1\", className)} {...props} />;\n}\n\n/** Names a SelectGroup. Must be rendered inside the group it labels. */\nexport function SelectGroupLabel({ className, ...props }: BaseSelect.GroupLabel.Props) {\n  return (\n    <BaseSelect.GroupLabel\n      className={withBase(\"px-2 pt-2 pb-1 text-xs font-medium text-zinc-500 select-none dark:text-zinc-500\", className)}\n      {...props}\n    />\n  );\n}\n\n/** A divider between groups of options. */\nexport function SelectSeparator({ className, ...props }: ComponentProps<typeof BaseSelect.Separator>) {\n  return (\n    <BaseSelect.Separator\n      className={withBase(\"-mx-1.5 my-1.5 h-px bg-zinc-950/[0.07] dark:bg-white/[0.08]\", className)}\n      {...props}\n    />\n  );\n}\n"
    }
  ],
  "example": {
    "content": "\"use client\";\n\nimport {\n  Select,\n  SelectContent,\n  SelectGroup,\n  SelectGroupLabel,\n  SelectItem,\n  SelectLabel,\n  SelectSeparator,\n  SelectTrigger,\n} from \"@/components/shaken/ui/select\";\n\nconst models = [\n  { value: \"atlas-large\", label: \"Atlas Large\" },\n  { value: \"atlas-small\", label: \"Atlas Small\" },\n  { value: \"orbit-code\", label: \"Orbit Code\" },\n  { value: \"orbit-vision\", label: \"Orbit Vision\" },\n  { value: \"local-llama\", label: \"Local model\" },\n];\n\nconst regions = [\n  { value: \"eu-central\", label: \"Frankfurt (eu-central)\" },\n  { value: \"us-east\", label: \"Virginia (us-east)\" },\n  { value: \"ap-south\", label: \"Mumbai (ap-south)\" },\n];\n\nfunction SparkIcon() {\n  return (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinejoin=\"round\">\n      <path d=\"M8 2l1.4 4.6L14 8l-4.6 1.4L8 14l-1.4-4.6L2 8l4.6-1.4L8 2z\" />\n    </svg>\n  );\n}\n\nfunction CodeIcon() {\n  return (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <path d=\"M5.5 4.5L2 8l3.5 3.5M10.5 4.5L14 8l-3.5 3.5\" />\n    </svg>\n  );\n}\n\nfunction EyeIcon() {\n  return (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\">\n      <path d=\"M1.75 8S4 3.75 8 3.75 14.25 8 14.25 8 12 12.25 8 12.25 1.75 8 1.75 8z\" />\n      <circle cx=\"8\" cy=\"8\" r=\"2\" />\n    </svg>\n  );\n}\n\nfunction ChipIcon() {\n  return (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\">\n      <rect x=\"3\" y=\"3\" width=\"10\" height=\"10\" rx=\"2\" />\n      <rect x=\"6\" y=\"6\" width=\"4\" height=\"4\" rx=\"0.5\" />\n    </svg>\n  );\n}\n\nexport default function SelectExample() {\n  return (\n    <div className=\"grid w-full max-w-xs gap-6\">\n      <Select items={models} defaultValue=\"atlas-large\" name=\"model\">\n        <div className=\"grid gap-1.5\">\n          <SelectLabel>Model</SelectLabel>\n          <SelectTrigger />\n        </div>\n        <SelectContent>\n          <SelectGroup>\n            <SelectGroupLabel>General</SelectGroupLabel>\n            <SelectItem value=\"atlas-large\" icon={<SparkIcon />}>\n              Atlas Large\n            </SelectItem>\n            <SelectItem value=\"atlas-small\" icon={<SparkIcon />}>\n              Atlas Small\n            </SelectItem>\n          </SelectGroup>\n          <SelectSeparator />\n          <SelectGroup>\n            <SelectGroupLabel>Specialized</SelectGroupLabel>\n            <SelectItem value=\"orbit-code\" icon={<CodeIcon />}>\n              Orbit Code\n            </SelectItem>\n            <SelectItem value=\"orbit-vision\" icon={<EyeIcon />}>\n              Orbit Vision\n            </SelectItem>\n          </SelectGroup>\n          <SelectSeparator />\n          <SelectItem value=\"local-llama\" icon={<ChipIcon />} disabled>\n            Local model\n          </SelectItem>\n        </SelectContent>\n      </Select>\n\n      <Select items={regions} name=\"region\">\n        <div className=\"grid gap-1.5\">\n          <SelectLabel>Data region</SelectLabel>\n          <SelectTrigger placeholder=\"Choose a region\" />\n        </div>\n        <SelectContent>\n          {regions.map((region) => (\n            <SelectItem key={region.value} value={region.value}>\n              {region.label}\n            </SelectItem>\n          ))}\n        </SelectContent>\n      </Select>\n    </div>\n  );\n}\n"
  }
}
