{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "p-select-11",
  "description": "Select in form",
  "registryDependencies": [
    "@coss/button",
    "@coss/field",
    "@coss/form",
    "@coss/select"
  ],
  "files": [
    {
      "path": "registry/default/particles/p-select-11.tsx",
      "content": "\"use client\";\n\nimport type { FormEvent } from \"react\";\nimport { useState } from \"react\";\nimport { Button } from \"@/registry/default/ui/button\";\nimport {\n  Field,\n  FieldDescription,\n  FieldError,\n  FieldLabel,\n} from \"@/registry/default/ui/field\";\nimport { Form } from \"@/registry/default/ui/form\";\nimport {\n  Select,\n  SelectItem,\n  SelectPopup,\n  SelectTrigger,\n  SelectValue,\n} from \"@/registry/default/ui/select\";\n\nconst items = [\n  { label: \"Next.js\", value: \"next\" },\n  { label: \"Vite\", value: \"vite\" },\n  { label: \"Astro\", value: \"astro\" },\n];\n\nexport default function Particle() {\n  const [loading, setLoading] = useState(false);\n  const onSubmit = async (e: FormEvent<HTMLFormElement>) => {\n    e.preventDefault();\n    const formData = new FormData(e.currentTarget);\n    setLoading(true);\n    await new Promise((r) => setTimeout(r, 800));\n    setLoading(false);\n    alert(`Framework: ${formData.get(\"framework\") || \"\"}`);\n  };\n\n  return (\n    <Form className=\"max-w-64\" onSubmit={onSubmit}>\n      <Field>\n        <FieldLabel>Framework</FieldLabel>\n        <Select\n          aria-label=\"Select framework\"\n          items={items}\n          name=\"framework\"\n          required\n        >\n          <SelectTrigger>\n            <SelectValue placeholder=\"Select a framework\" />\n          </SelectTrigger>\n          <SelectPopup>\n            {items.map(({ label, value }) => (\n              <SelectItem key={value} value={value}>\n                {label}\n              </SelectItem>\n            ))}\n          </SelectPopup>\n        </Select>\n        <FieldDescription>Pick your favorite.</FieldDescription>\n        <FieldError>Please select a value.</FieldError>\n      </Field>\n\n      <Button loading={loading} type=\"submit\">\n        Submit\n      </Button>\n    </Form>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": "**:data-[slot=preview]:w-full **:data-[slot=preview]:max-w-64"
  },
  "categories": [
    "select"
  ],
  "type": "registry:block"
}