{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "v-form-10",
  "description": "Feedback form with rating",
  "registryDependencies": [
    "@cnippet/form"
  ],
  "files": [
    {
      "path": "registry/default/variants/v-form-10.tsx",
      "content": "// title: Feedback form with rating\n\"use client\";\n\nimport { CheckCircle2Icon } from \"lucide-react\";\nimport { type FormEvent, useState } from \"react\";\nimport { Button } from \"@/registry/default/ui/button\";\nimport { Field, FieldError, FieldLabel } 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\";\nimport { Textarea } from \"@/registry/default/ui/textarea\";\n\nexport function Pattern() {\n  const [loading, setLoading] = useState(false);\n  const [done, setDone] = useState(false);\n\n  const onSubmit = async (e: FormEvent<HTMLFormElement>) => {\n    e.preventDefault();\n    setLoading(true);\n    await new Promise((r) => setTimeout(r, 900));\n    setLoading(false);\n    setDone(true);\n  };\n\n  if (done) {\n    return (\n      <div className=\"flex w-full max-w-sm flex-col items-center gap-3 py-8 text-center\">\n        <div className=\"flex size-11 items-center justify-center rounded-full bg-success/10\">\n          <CheckCircle2Icon className=\"size-5 text-success\" />\n        </div>\n        <div className=\"space-y-1\">\n          <p className=\"font-semibold\">Thanks for your feedback!</p>\n          <p className=\"text-muted-foreground text-sm\">\n            We review every submission and use it to improve.\n          </p>\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <Form className=\"w-full max-w-sm gap-4\" onSubmit={onSubmit}>\n      <div className=\"space-y-1\">\n        <h2 className=\"font-semibold\">Share your feedback</h2>\n        <p className=\"text-muted-foreground text-sm\">\n          How are we doing? We read every response.\n        </p>\n      </div>\n\n      <Field name=\"rating\">\n        <FieldLabel>Overall rating</FieldLabel>\n        <Select\n          defaultValue=\"good\"\n          items={[\n            { label: \"⭐ Poor\", value: \"poor\" },\n            { label: \"⭐⭐ Fair\", value: \"fair\" },\n            { label: \"⭐⭐⭐ Good\", value: \"good\" },\n            { label: \"⭐⭐⭐⭐ Very Good\", value: \"very-good\" },\n            { label: \"⭐⭐⭐⭐⭐ Excellent\", value: \"excellent\" },\n          ]}\n        >\n          <SelectTrigger>\n            <SelectValue />\n          </SelectTrigger>\n          <SelectPopup>\n            <SelectItem value=\"poor\">⭐ Poor</SelectItem>\n            <SelectItem value=\"fair\">⭐⭐ Fair</SelectItem>\n            <SelectItem value=\"good\">⭐⭐⭐ Good</SelectItem>\n            <SelectItem value=\"very-good\">⭐⭐⭐⭐ Very Good</SelectItem>\n            <SelectItem value=\"excellent\">⭐⭐⭐⭐⭐ Excellent</SelectItem>\n          </SelectPopup>\n        </Select>\n        <FieldError />\n      </Field>\n\n      <Field name=\"comment\">\n        <FieldLabel>What could we improve?</FieldLabel>\n        <Textarea\n          placeholder=\"Tell us what you liked or what we could do better…\"\n          required\n          rows={4}\n        />\n        <FieldError />\n      </Field>\n\n      <Button className=\"w-full\" loading={loading} type=\"submit\">\n        Submit feedback\n      </Button>\n    </Form>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": ""
  },
  "categories": [
    "form"
  ],
  "type": "registry:block"
}