import { createEffect, createSignal } from "solid-js" import { Field } from "@opencode/ui/field" import { Select, type SelectProps } from "./select" const fruits = ["Apple", "Banana", "Cherry", "Date", "Elderberry"] type Region = "North" | "South" | "East" | "West" const cities: { city: string; region: Region }[] = [ { city: "Boston", region: "North" }, { city: "Miami", region: "South" }, { city: "Atlanta", region: "South" }, { city: "Seattle", region: "West" }, { city: "Denver", region: "West" }, ] const docs = `### Overview Single-select built on Kobalte with current menu styling. The trigger is inline by default, or an input field that matches the text input. ### API - \`appearance\`: \`inline\` (default) is the borderless trigger; \`small\`, \`base\` and \`large\` are 24px, 28px and 32px input fields. - \`surface\`: \`base\` (default), \`layer-1\` or \`invisible\` for input fields; invisible gains a fill on hover. - \`placeholder\`: Shown in the trigger when nothing is selected (same idea as text inputs). - \`options\`, \`current\`, \`onSelect\`: controlled selection (\`current\` is the selected option object). - \`value\` / \`label\`: accessors when options are not plain strings. - \`groupBy\`: groups options; section headers use menu group label styling. - \`placement\`, \`gutter\`, \`sameWidth\`, \`flip\`, \`slide\`, \`fitViewport\`: forwarded to Kobalte popper. - \`invalid\`, \`disabled\`, \`numeric\`: match text input conventions. ` type Controls = Pick< SelectProps, | "appearance" | "surface" | "invalid" | "disabled" | "numeric" | "placeholder" | "open" | "placement" | "gutter" | "sameWidth" | "closeOnSelection" | "slide" | "flip" | "fitViewport" > function Sample(props: SelectProps) { const [current, setCurrent] = createSignal(props.current) const [open, setOpen] = createSignal(false) createEffect(() => setOpen(!!props.open)) return (