{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auto-form-field-overrides",
  "title": "Auto Form with Field Overrides",
  "description": "Shows the override layer of a generated form: relabelled fields, a textarea and a radio group instead of the defaults, a hidden field, custom option labels, a disabled field and a custom order. Use this when the schema is right but the presentation needs a nudge.",
  "registryDependencies": [
    "@tealmac/auto-form"
  ],
  "files": [
    {
      "path": "registry/patterns/auto-form-field-overrides/auto-form-field-overrides.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { AutoForm, type JsonSchema } from \"@/components/ui/auto-form\"\n\nconst schema: JsonSchema = {\n  type: \"object\",\n  title: \"New ticket\",\n  required: [\"subject\", \"priority\"],\n  \"x-order\": [\"subject\", \"priority\", \"details\", \"notify\", \"internalId\"],\n  properties: {\n    internalId: { type: \"string\", default: \"TKT-1042\" },\n    notify: { type: \"boolean\", title: \"notify\" },\n    details: { type: \"string\", maxLength: 1000 },\n    priority: {\n      type: \"string\",\n      enum: [\"low\", \"normal\", \"urgent\"],\n      default: \"normal\",\n    },\n    subject: { type: \"string\", minLength: 3 },\n  },\n}\n\nexport interface AutoFormFieldOverridesProps {\n  onSubmit?: (values: Record<string, unknown>) => void\n}\n\nexport function AutoFormFieldOverrides({\n  onSubmit,\n}: AutoFormFieldOverridesProps) {\n  return (\n    <div className=\"w-full max-w-md\">\n      <AutoForm\n        schema={schema}\n        fieldConfig={{\n          subject: {\n            label: \"What do you need help with?\",\n            placeholder: \"Short summary\",\n          },\n          priority: {\n            widget: \"radio\",\n            optionLabels: {\n              low: \"Low (a week)\",\n              normal: \"Normal (2 days)\",\n              urgent: \"Urgent (today)\",\n            },\n          },\n          details: {\n            widget: \"textarea\",\n            description:\n              \"Steps to reproduce, what you expected, what happened.\",\n          },\n          notify: { widget: \"switch\", label: \"Email me updates\" },\n          internalId: { disabled: true, label: \"Ticket number\" },\n        }}\n        submitLabel=\"Open ticket\"\n        onSubmit={(values) => onSubmit?.(values)}\n      />\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}