[{"data":1,"prerenderedAt":618},["ShallowReactive",2],{"content-\u002Fdocs\u002Fapi\u002Fzod":3},{"id":4,"title":5,"body":6,"description":610,"extension":611,"meta":612,"navigation":613,"path":614,"seo":615,"stem":616,"__hash__":617},"docs\u002Fdocs\u002Fapi\u002Fzod.md","attaform\u002Fzod",{"type":7,"value":8,"toc":598},"minimark",[9,16,24,53,60,68,123,126,434,438,455,465,468,483,489,492,499,518,525,533,539,550,556,573,579,582,588,594],[10,11,13],"h1",{"id":12},"attaformzod",[14,15,5],"code",{},[17,18,19,20,23],"p",{},"Zod v4 adapter. Requires ",[14,21,22],{},"zod@^4",".",[25,26,31],"pre",{"className":27,"code":28,"language":29,"meta":30,"style":30},"language-ts shiki shiki-themes github-light github-dark","import { useForm, zodAdapter, kindOf, assertZodVersion } from 'attaform\u002Fzod'\n","ts","",[14,32,33],{"__ignoreMap":30},[34,35,38,42,46,49],"span",{"class":36,"line":37},"line",1,[34,39,41],{"class":40},"szBVR","import",[34,43,45],{"class":44},"sVt8B"," { useForm, zodAdapter, kindOf, assertZodVersion } ",[34,47,48],{"class":40},"from",[34,50,52],{"class":51},"sZZnC"," 'attaform\u002Fzod'\n",[54,55,57],"h2",{"id":56},"useformschemaoptions",[14,58,59],{},"useForm\u003CSchema>(options)",[17,61,62,63,23],{},"The primary entry point. Returns a typed reactive surface; see\n",[64,65,67],"a",{"href":66},"\u002Fdocs\u002Fapi\u002Fuse-form-return","The useForm return value",[25,69,71],{"className":27,"code":70,"language":29,"meta":30,"style":30},"const schema = z.object({ email: z.email() })\nconst form = useForm({ schema, key: 'signup' })\n",[14,72,73,101],{"__ignoreMap":30},[34,74,75,78,82,85,88,92,95,98],{"class":36,"line":37},[34,76,77],{"class":40},"const",[34,79,81],{"class":80},"sj4cs"," schema",[34,83,84],{"class":40}," =",[34,86,87],{"class":44}," z.",[34,89,91],{"class":90},"sScJk","object",[34,93,94],{"class":44},"({ email: z.",[34,96,97],{"class":90},"email",[34,99,100],{"class":44},"() })\n",[34,102,104,106,109,111,114,117,120],{"class":36,"line":103},2,[34,105,77],{"class":40},[34,107,108],{"class":80}," form",[34,110,84],{"class":40},[34,112,113],{"class":90}," useForm",[34,115,116],{"class":44},"({ schema, key: ",[34,118,119],{"class":51},"'signup'",[34,121,122],{"class":44}," })\n",[17,124,125],{},"Options:",[127,128,129,148],"table",{},[130,131,132],"thead",{},[133,134,135,139,142,145],"tr",{},[136,137,138],"th",{},"Field",[136,140,141],{},"Type",[136,143,144],{},"Required",[136,146,147],{},"Description",[149,150,151,170,196,221,250,281,310,334,367,388,412],"tbody",{},[133,152,153,159,164,167],{},[154,155,156],"td",{},[14,157,158],{},"schema",[154,160,161],{},[14,162,163],{},"z.ZodType",[154,165,166],{},"yes",[154,168,169],{},"The Zod schema describing the form shape.",[133,171,172,177,182,185],{},[154,173,174],{},[14,175,176],{},"key",[154,178,179],{},[14,180,181],{},"string",[154,183,184],{},"no",[154,186,187,188,191,192,23],{},"Form identity for ",[14,189,190],{},"injectForm(key)",", shared state, persistence keys, or DevTools labels. See ",[64,193,195],{"href":194},"#keys","Keys",[133,197,198,203,208,210],{},[154,199,200],{},[14,201,202],{},"defaultValues",[154,204,205],{},[14,206,207],{},"DeepPartial\u003CDefaultValuesShape\u003CForm>>",[154,209,184],{},[154,211,212,213,216,217,23],{},"Constraints applied over schema defaults. Each leaf may be the ",[14,214,215],{},"unset"," sentinel. See ",[64,218,220],{"href":219},"#default-values","Default values",[133,222,223,228,233,235],{},[154,224,225],{},[14,226,227],{},"strict",[154,229,230],{},[14,231,232],{},"boolean",[154,234,184],{},[154,236,237,238,241,242,245,246,249],{},"Default ",[14,239,240],{},"true"," — defaults that fail the schema seed ",[14,243,244],{},"schemaErrors"," at construction. ",[14,247,248],{},"false"," opts out (multi-step wizards, placeholder rows).",[133,251,252,257,272,274],{},[154,253,254],{},[14,255,256],{},"onInvalidSubmit",[154,258,259,262,263,262,266,262,269],{},[14,260,261],{},"'none'"," | ",[14,264,265],{},"'focus-first-error'",[14,267,268],{},"'scroll-to-first-error'",[14,270,271],{},"'both'",[154,273,184],{},[154,275,276,277,23],{},"Behaviour on failed submit. See ",[64,278,280],{"href":279},"\u002Fdocs\u002Frecipes\u002Ffocus-on-error","recipe",[133,282,283,288,299,301],{},[154,284,285],{},[14,286,287],{},"validateOn",[154,289,290,262,293,262,296],{},[14,291,292],{},"'change'",[14,294,295],{},"'blur'",[14,297,298],{},"'submit'",[154,300,184],{},[154,302,303,304,306,307,23],{},"When per-field validation runs. Default ",[14,305,292],{},". See ",[64,308,280],{"href":309},"\u002Fdocs\u002Frecipes\u002Ffield-level-validation",[133,311,312,317,322,324],{},[154,313,314],{},[14,315,316],{},"debounceMs",[154,318,319],{},[14,320,321],{},"number",[154,323,184],{},[154,325,326,327,330,331,23],{},"Wait after the last write before re-validating. Default ",[14,328,329],{},"0",". Only valid with ",[14,332,333],{},"validateOn: 'change'",[133,335,336,341,348,350],{},[154,337,338],{},[14,339,340],{},"coerce",[154,342,343,262,345],{},[14,344,232],{},[14,346,347],{},"CoercionRegistry",[154,349,184],{},[154,351,352,353,355,356,359,360,363,364,23],{},"DOM-input coercion. Default ",[14,354,240],{}," (",[14,357,358],{},"string→number",", ",[14,361,362],{},"string→boolean","). See ",[64,365,280],{"href":366},"\u002Fdocs\u002Frecipes\u002Fcoerce",[133,368,369,374,378,380],{},[154,370,371],{},[14,372,373],{},"rememberVariants",[154,375,376],{},[14,377,232],{},[154,379,184],{},[154,381,237,382,384,385,23],{},[14,383,240],{}," — switching back to a discriminated-union variant restores its prior subtree. See ",[64,386,280],{"href":387},"\u002Fdocs\u002Frecipes\u002Fdiscriminated-unions",[133,389,390,395,400,402],{},[154,391,392],{},[14,393,394],{},"persist",[154,396,397],{},[14,398,399],{},"FormStorageKind | FormStorage | { storage, key?, debounceMs?, include?, clearOnSubmitSuccess? }",[154,401,184],{},[154,403,404,405,306,408,23],{},"Persistence config. Per-field opt-in lives at ",[14,406,407],{},"register()",[64,409,411],{"href":410},"#persistence-config","Persistence config",[133,413,414,419,426,428],{},[154,415,416],{},[14,417,418],{},"history",[154,420,421,262,423],{},[14,422,240],{},[14,424,425],{},"{ max?: number }",[154,427,184],{},[154,429,430,431,23],{},"Enable undo\u002Fredo. See ",[64,432,280],{"href":433},"\u002Fdocs\u002Frecipes\u002Fundo-redo",[435,436,195],"h3",{"id":437},"keys",[17,439,440,441,444,445,448,449,451,452,454],{},"Omit for one-off forms — the runtime allocates a synthetic\n",[14,442,443],{},"__atta:anon:\u003Cid>"," via ",[14,446,447],{},"useId()",". Pass a string when you need\ncross-component lookup via ",[14,450,190],{},", shared state across\ncall-sites, a stable ",[14,453,394],{}," storage-key default, or a\nrecognisable DevTools label.",[17,456,457,458,461,462,23],{},"Keys starting with ",[14,459,460],{},"__atta:"," are reserved for the library's\ninternal synthetic-key namespace; passing one throws\n",[14,463,464],{},"ReservedFormKeyError",[435,466,220],{"id":467},"default-values",[17,469,470,471,474,475,478,479,482],{},"Refinement-invalid leaves that satisfy the slim primitive type at\ntheir path (e.g. ",[14,472,473],{},"'teal'"," against ",[14,476,477],{},"z.enum(['red','green','blue'])",",\na 4-character string against ",[14,480,481],{},"z.string().min(8)",") pass through\nunchanged so SSR \u002F autosave rehydration can land partial-but-saved\nstate as-is. Wrong-primitive leaves (a number where a string is\nexpected) are still replaced by the schema default.",[17,484,485,486,488],{},"Each primitive leaf may be the ",[14,487,215],{}," sentinel to mark the path\ndisplayed-empty at construction.",[435,490,411],{"id":491},"persistence-config",[17,493,494,495,498],{},"The form-level option is operational only — backend, key,\ndebounce, error inclusion. Per-field opt-in lives at every\n",[14,496,497],{},"register('foo', { persist: true })"," call site; this config alone\nnever causes any field to persist.",[17,500,501,502,505,506,509,510,513,514,517],{},"Three input forms: a string shorthand (",[14,503,504],{},"'local'"," \u002F ",[14,507,508],{},"'session'"," \u002F\n",[14,511,512],{},"'indexeddb'","), a custom ",[14,515,516],{},"FormStorage"," adapter passed directly, or\nthe full options bag.",[17,519,520,521,524],{},"Storage keys carry the schema's fingerprint\n(",[14,522,523],{},"${base}:${fingerprint}",") so schema changes auto-invalidate old\ndrafts. The orphan-cleanup pass on mount sweeps stale-fingerprint\nentries on the configured backend AND wipes any matching keys on\nthe non-configured standard backends. Malformed payloads are wiped\non read.",[17,526,527,528,532],{},"See ",[64,529,531],{"href":530},"\u002Fdocs\u002Frecipes\u002Fpersistence","persistence recipe"," for the full pattern.",[54,534,536],{"id":535},"zodadapterschema",[14,537,538],{},"zodAdapter(schema)",[17,540,541,542,545,546,549],{},"Lower-level. Returns an ",[14,543,544],{},"AbstractSchema\u003CForm, Form>"," that wraps a\nZod schema. Use it only when composing your own ",[14,547,548],{},"useForm","-like\nhook.",[54,551,553],{"id":552},"kindofschema",[14,554,555],{},"kindOf(schema)",[17,557,558,559,359,562,359,565,568,569,572],{},"Returns the zod kind (",[14,560,561],{},"'string'",[14,563,564],{},"'number'",[14,566,567],{},"'object'",",\n",[14,570,571],{},"'discriminated-union'",", etc.) for a zod v4 schema. For advanced\nadapter work.",[54,574,576],{"id":575},"assertzodversionversion",[14,577,578],{},"assertZodVersion(version)",[17,580,581],{},"Throws if the installed zod major doesn't match the argument.",[54,583,585],{"id":584},"type-zodkind",[14,586,587],{},"type ZodKind",[17,589,590,591,23],{},"Union of the strings returned by ",[14,592,593],{},"kindOf",[595,596,597],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}",{"title":30,"searchDepth":103,"depth":103,"links":599},[600,606,607,608,609],{"id":56,"depth":103,"text":59,"children":601},[602,604,605],{"id":437,"depth":603,"text":195},3,{"id":467,"depth":603,"text":220},{"id":491,"depth":603,"text":411},{"id":535,"depth":103,"text":538},{"id":552,"depth":103,"text":555},{"id":575,"depth":103,"text":578},{"id":584,"depth":103,"text":587},"Zod v4 adapter. Requires zod@^4.","md",{},true,"\u002Fdocs\u002Fapi\u002Fzod",{"title":5,"description":610},"docs\u002Fapi\u002Fzod","Iy9ACQ97Hc_Ral5TZ1peN8YTQ4yOMvptWbYlQzTzPL4",1777934135911]