[{"data":1,"prerenderedAt":1271},["ShallowReactive",2],{"content-\u002Fdocs\u002Fschemas\u002Fdefaults":3},{"id":4,"title":5,"body":6,"description":1250,"extension":1251,"meta":1252,"metaRows":1253,"navigation":172,"path":1266,"seo":1267,"source":1268,"stem":1269,"__hash__":1270},"docs\u002Fdocs\u002Fschemas\u002Fdefaults.md","Defaults from the schema",{"type":7,"value":8,"toc":1235},"minimark",[9,13,37,40,50,55,60,223,234,240,291,298,308,370,377,380,386,506,533,537,545,667,677,681,694,698,704,753,758,807,819,841,845,852,856,875,947,964,977,980,1047,1063,1071,1074,1170,1189,1197,1201,1231],[10,11,5],"h1",{"id":12},"defaults-from-the-schema",[14,15,16],"blockquote",{},[17,18,19,20,24,25,28,29,32,33,36],"p",{},"Schema ",[21,22,23],"code",{},".default()"," declarations seed ",[21,26,27],{},"form.values"," at mount and re-seed on ",[21,30,31],{},"reset()",". The per-form ",[21,34,35],{},"defaultValues"," option overlays the schema's defaults. Same semantics, different scope.",[38,39],"docs-meta-table",{},[17,41,42,43,45,46,49],{},"The demo below shows the same schema mounted three ways: bare (defaults from the schema), with a ",[21,44,35],{}," overlay (per-form override), and with ",[21,47,48],{},"unset"," (a specific leaf opted back to blank). Each form starts from the same declaration; the option drives the initial state.",[51,52],"docs-demo",{"label":53,"slug":54},"Schema Defaults Demo","schema-defaults",[56,57,59],"h2",{"id":58},"schema-declared-defaults","Schema-declared defaults",[61,62,67],"pre",{"className":63,"code":64,"language":65,"meta":66,"style":66},"language-ts shiki shiki-themes github-light github-dark","const schema = z.object({\n  notify: z.boolean().default(true),\n  count: z.number().default(10),\n  tag: z.string().default('untitled'),\n})\n\nconst form = useForm({ schema })\n\nform.values.notify \u002F\u002F true\nform.values.count \u002F\u002F 10\nform.values.tag \u002F\u002F 'untitled'\n","ts","",[21,68,69,96,120,140,161,167,174,190,195,205,214],{"__ignoreMap":66},[70,71,74,78,82,85,89,93],"span",{"class":72,"line":73},"line",1,[70,75,77],{"class":76},"szBVR","const",[70,79,81],{"class":80},"sj4cs"," schema",[70,83,84],{"class":76}," =",[70,86,88],{"class":87},"sVt8B"," z.",[70,90,92],{"class":91},"sScJk","object",[70,94,95],{"class":87},"({\n",[70,97,99,102,105,108,111,114,117],{"class":72,"line":98},2,[70,100,101],{"class":87},"  notify: z.",[70,103,104],{"class":91},"boolean",[70,106,107],{"class":87},"().",[70,109,110],{"class":91},"default",[70,112,113],{"class":87},"(",[70,115,116],{"class":80},"true",[70,118,119],{"class":87},"),\n",[70,121,123,126,129,131,133,135,138],{"class":72,"line":122},3,[70,124,125],{"class":87},"  count: z.",[70,127,128],{"class":91},"number",[70,130,107],{"class":87},[70,132,110],{"class":91},[70,134,113],{"class":87},[70,136,137],{"class":80},"10",[70,139,119],{"class":87},[70,141,143,146,149,151,153,155,159],{"class":72,"line":142},4,[70,144,145],{"class":87},"  tag: z.",[70,147,148],{"class":91},"string",[70,150,107],{"class":87},[70,152,110],{"class":91},[70,154,113],{"class":87},[70,156,158],{"class":157},"sZZnC","'untitled'",[70,160,119],{"class":87},[70,162,164],{"class":72,"line":163},5,[70,165,166],{"class":87},"})\n",[70,168,170],{"class":72,"line":169},6,[70,171,173],{"emptyLinePlaceholder":172},true,"\n",[70,175,177,179,182,184,187],{"class":72,"line":176},7,[70,178,77],{"class":76},[70,180,181],{"class":80}," form",[70,183,84],{"class":76},[70,185,186],{"class":91}," useForm",[70,188,189],{"class":87},"({ schema })\n",[70,191,193],{"class":72,"line":192},8,[70,194,173],{"emptyLinePlaceholder":172},[70,196,198,201],{"class":72,"line":197},9,[70,199,200],{"class":87},"form.values.notify ",[70,202,204],{"class":203},"sJ8bj","\u002F\u002F true\n",[70,206,208,211],{"class":72,"line":207},10,[70,209,210],{"class":87},"form.values.count ",[70,212,213],{"class":203},"\u002F\u002F 10\n",[70,215,217,220],{"class":72,"line":216},11,[70,218,219],{"class":87},"form.values.tag ",[70,221,222],{"class":203},"\u002F\u002F 'untitled'\n",[17,224,225,226,229,230,233],{},"At mount, the adapter resolves the schema's declared defaults into a complete initial value tree. ",[21,227,228],{},"form.values.\u003Cpath>"," reads concrete types: no ",[21,231,232],{},"undefined",", no manual checks for \"did the schema run yet?\"",[17,235,236,237,239],{},"The same defaults re-seed on ",[21,238,31],{},":",[61,241,243],{"className":63,"code":242,"language":65,"meta":66,"style":66},"form.setValue('count', 99)\nform.values.count \u002F\u002F 99\nform.reset()\nform.values.count \u002F\u002F 10, back to the schema's default\n",[21,244,245,267,274,284],{"__ignoreMap":66},[70,246,247,250,253,255,258,261,264],{"class":72,"line":73},[70,248,249],{"class":87},"form.",[70,251,252],{"class":91},"setValue",[70,254,113],{"class":87},[70,256,257],{"class":157},"'count'",[70,259,260],{"class":87},", ",[70,262,263],{"class":80},"99",[70,265,266],{"class":87},")\n",[70,268,269,271],{"class":72,"line":98},[70,270,210],{"class":87},[70,272,273],{"class":203},"\u002F\u002F 99\n",[70,275,276,278,281],{"class":72,"line":122},[70,277,249],{"class":87},[70,279,280],{"class":91},"reset",[70,282,283],{"class":87},"()\n",[70,285,286,288],{"class":72,"line":142},[70,287,210],{"class":87},[70,289,290],{"class":203},"\u002F\u002F 10, back to the schema's default\n",[56,292,294,295,297],{"id":293},"per-form-defaultvalues-overlay","Per-form ",[21,296,35],{}," overlay",[17,299,300,301,303,304,307],{},"When you pass ",[21,302,35],{}," to ",[21,305,306],{},"useForm",", the overlay sits on top of the schema's defaults:",[61,309,311],{"className":63,"code":310,"language":65,"meta":66,"style":66},"const form = useForm({\n  schema,\n  defaultValues: { count: 42 },\n})\n\nform.values.notify \u002F\u002F true        ← schema default\nform.values.count \u002F\u002F 42         ← overlay wins\nform.values.tag \u002F\u002F 'untitled'  ← schema default\n",[21,312,313,325,330,341,345,349,356,363],{"__ignoreMap":66},[70,314,315,317,319,321,323],{"class":72,"line":73},[70,316,77],{"class":76},[70,318,181],{"class":80},[70,320,84],{"class":76},[70,322,186],{"class":91},[70,324,95],{"class":87},[70,326,327],{"class":72,"line":98},[70,328,329],{"class":87},"  schema,\n",[70,331,332,335,338],{"class":72,"line":122},[70,333,334],{"class":87},"  defaultValues: { count: ",[70,336,337],{"class":80},"42",[70,339,340],{"class":87}," },\n",[70,342,343],{"class":72,"line":142},[70,344,166],{"class":87},[70,346,347],{"class":72,"line":163},[70,348,173],{"emptyLinePlaceholder":172},[70,350,351,353],{"class":72,"line":169},[70,352,200],{"class":87},[70,354,355],{"class":203},"\u002F\u002F true        ← schema default\n",[70,357,358,360],{"class":72,"line":176},[70,359,210],{"class":87},[70,361,362],{"class":203},"\u002F\u002F 42         ← overlay wins\n",[70,364,365,367],{"class":72,"line":192},[70,366,219],{"class":87},[70,368,369],{"class":203},"\u002F\u002F 'untitled'  ← schema default\n",[17,371,372,373,376],{},"The overlay is a ",[21,374,375],{},"DeepPartial"," of the form's input shape. Supply only the leaves you want to override; missing leaves fall back to the schema's declared default.",[17,378,379],{},"This is the right place for environment-specific defaults: a \"remember me\" toggle defaulting to true on a desktop app vs. false on a kiosk, a discount-rate default that flows from a feature flag, etc.",[56,381,383,384],{"id":382},"three-patterns-for-defaultvalues","Three patterns for ",[21,385,35],{},[61,387,389],{"className":63,"code":388,"language":65,"meta":66,"style":66},"import { unset } from 'attaform\u002Fzod'\n\n\u002F\u002F 1. Plain values: explicit defaults flow into storage\nuseForm({ schema, defaultValues: { email: 'me@example.com', count: 10 } })\n\n\u002F\u002F 2. Omit defaultValues entirely: numeric leaves auto-mark blank,\n\u002F\u002F    strings and booleans take their schema default\nuseForm({ schema })\n\n\u002F\u002F 3. Mark any path as `unset`: leaf, container, or the whole form.\n\u002F\u002F    The runtime writes the schema's slim value and flags every\n\u002F\u002F    primitive descendant in form.blankPaths.\nuseForm({ schema, defaultValues: { email: unset, count: 10 } })\nuseForm({ schema, defaultValues: { profile: unset } }) \u002F\u002F whole container\nuseForm({ schema, defaultValues: unset }) \u002F\u002F every primitive leaf\n",[21,390,391,405,409,414,432,436,441,446,452,456,461,466,472,484,495],{"__ignoreMap":66},[70,392,393,396,399,402],{"class":72,"line":73},[70,394,395],{"class":76},"import",[70,397,398],{"class":87}," { unset } ",[70,400,401],{"class":76},"from",[70,403,404],{"class":157}," 'attaform\u002Fzod'\n",[70,406,407],{"class":72,"line":98},[70,408,173],{"emptyLinePlaceholder":172},[70,410,411],{"class":72,"line":122},[70,412,413],{"class":203},"\u002F\u002F 1. Plain values: explicit defaults flow into storage\n",[70,415,416,418,421,424,427,429],{"class":72,"line":142},[70,417,306],{"class":91},[70,419,420],{"class":87},"({ schema, defaultValues: { email: ",[70,422,423],{"class":157},"'me@example.com'",[70,425,426],{"class":87},", count: ",[70,428,137],{"class":80},[70,430,431],{"class":87}," } })\n",[70,433,434],{"class":72,"line":163},[70,435,173],{"emptyLinePlaceholder":172},[70,437,438],{"class":72,"line":169},[70,439,440],{"class":203},"\u002F\u002F 2. Omit defaultValues entirely: numeric leaves auto-mark blank,\n",[70,442,443],{"class":72,"line":176},[70,444,445],{"class":203},"\u002F\u002F    strings and booleans take their schema default\n",[70,447,448,450],{"class":72,"line":192},[70,449,306],{"class":91},[70,451,189],{"class":87},[70,453,454],{"class":72,"line":197},[70,455,173],{"emptyLinePlaceholder":172},[70,457,458],{"class":72,"line":207},[70,459,460],{"class":203},"\u002F\u002F 3. Mark any path as `unset`: leaf, container, or the whole form.\n",[70,462,463],{"class":72,"line":216},[70,464,465],{"class":203},"\u002F\u002F    The runtime writes the schema's slim value and flags every\n",[70,467,469],{"class":72,"line":468},12,[70,470,471],{"class":203},"\u002F\u002F    primitive descendant in form.blankPaths.\n",[70,473,475,477,480,482],{"class":72,"line":474},13,[70,476,306],{"class":91},[70,478,479],{"class":87},"({ schema, defaultValues: { email: unset, count: ",[70,481,137],{"class":80},[70,483,431],{"class":87},[70,485,487,489,492],{"class":72,"line":486},14,[70,488,306],{"class":91},[70,490,491],{"class":87},"({ schema, defaultValues: { profile: unset } }) ",[70,493,494],{"class":203},"\u002F\u002F whole container\n",[70,496,498,500,503],{"class":72,"line":497},15,[70,499,306],{"class":91},[70,501,502],{"class":87},"({ schema, defaultValues: unset }) ",[70,504,505],{"class":203},"\u002F\u002F every primitive leaf\n",[17,507,508,509,511,512,515,516,524,525,532],{},"The third pattern uses ",[21,510,48],{}," as a sentinel that lands at any path. Required schemas under the unset path surface a ",[21,513,514],{},"code: 'atta:no-value-supplied'"," error reactively. See ",[517,518,520,521,523],"a",{"href":519},"\u002Fdocs\u002Fwriting-and-mutating\u002Funset","the ",[21,522,48],{}," page"," for the position-by-position contract and ",[517,526,520,528,531],{"href":527},"\u002Fdocs\u002Fvalidation\u002Fblank",[21,529,530],{},"blank"," field-state bit"," for the storage \u002F display divergence story.",[56,534,536],{"id":535},"per-mount-sync-defaults","Per-mount sync defaults",[17,538,539,541,542,544],{},[21,540,35],{}," accepts a function as well as a plain value. The sync function form runs once per ",[21,543,306],{}," call (on a microtask after construction) and captures whatever's in scope at that moment. Use it when the defaults are cheap to compute but need to read live state at mount time, e.g. a per-instance session ID, the current timestamp, or a value pulled from a sync store:",[61,546,548],{"className":63,"code":547,"language":65,"meta":66,"style":66},"const sessionCounter = ref(0)\n\nconst form = useForm({\n  schema,\n  defaultValues: () => ({\n    sessionId: `sess-${++sessionCounter.value}`,\n    createdAt: new Date().toISOString(),\n    topic: '',\n  }),\n})\n",[21,549,550,569,573,585,589,603,629,648,658,663],{"__ignoreMap":66},[70,551,552,554,557,559,562,564,567],{"class":72,"line":73},[70,553,77],{"class":76},[70,555,556],{"class":80}," sessionCounter",[70,558,84],{"class":76},[70,560,561],{"class":91}," ref",[70,563,113],{"class":87},[70,565,566],{"class":80},"0",[70,568,266],{"class":87},[70,570,571],{"class":72,"line":98},[70,572,173],{"emptyLinePlaceholder":172},[70,574,575,577,579,581,583],{"class":72,"line":122},[70,576,77],{"class":76},[70,578,181],{"class":80},[70,580,84],{"class":76},[70,582,186],{"class":91},[70,584,95],{"class":87},[70,586,587],{"class":72,"line":142},[70,588,329],{"class":87},[70,590,591,594,597,600],{"class":72,"line":163},[70,592,593],{"class":91},"  defaultValues",[70,595,596],{"class":87},": () ",[70,598,599],{"class":76},"=>",[70,601,602],{"class":87}," ({\n",[70,604,605,608,611,614,617,620,623,626],{"class":72,"line":169},[70,606,607],{"class":87},"    sessionId: ",[70,609,610],{"class":157},"`sess-${",[70,612,613],{"class":76},"++",[70,615,616],{"class":87},"sessionCounter",[70,618,619],{"class":157},".",[70,621,622],{"class":87},"value",[70,624,625],{"class":157},"}`",[70,627,628],{"class":87},",\n",[70,630,631,634,637,640,642,645],{"class":72,"line":176},[70,632,633],{"class":87},"    createdAt: ",[70,635,636],{"class":76},"new",[70,638,639],{"class":91}," Date",[70,641,107],{"class":87},[70,643,644],{"class":91},"toISOString",[70,646,647],{"class":87},"(),\n",[70,649,650,653,656],{"class":72,"line":192},[70,651,652],{"class":87},"    topic: ",[70,654,655],{"class":157},"''",[70,657,628],{"class":87},[70,659,660],{"class":72,"line":197},[70,661,662],{"class":87},"  }),\n",[70,664,665],{"class":72,"line":207},[70,666,166],{"class":87},[17,668,669,670,673,674,676],{},"Each call to ",[21,671,672],{},"form.rehydrate()"," re-fires the captured factory, so a \"new session\" button is one method call away. The factory's closure picks up whatever the outer scope holds right now, which is the value over a plain frozen ",[21,675,35],{}," object.",[51,678],{"label":679,"slug":680},"Sync factory demo","defaults-sync-factory",[17,682,683,686,687,689,690,693],{},[21,684,685],{},"form.hydrating"," does flip ",[21,688,116],{}," for a microtask while the sync factory runs, then back to ",[21,691,692],{},"false",". Templates that read it usually won't see the brief flicker; the flag is mostly relevant for the async form below.",[56,695,697],{"id":696},"loading-defaults-asynchronously","Loading defaults asynchronously",[17,699,700,701,239],{},"When the defaults need a network round-trip, return a ",[21,702,703],{},"Promise",[61,705,707],{"className":63,"code":706,"language":65,"meta":66,"style":66},"const form = useForm({\n  schema,\n  defaultValues: async () => api.fetchDraft(userId),\n})\n",[21,708,709,721,725,749],{"__ignoreMap":66},[70,710,711,713,715,717,719],{"class":72,"line":73},[70,712,77],{"class":76},[70,714,181],{"class":80},[70,716,84],{"class":76},[70,718,186],{"class":91},[70,720,95],{"class":87},[70,722,723],{"class":72,"line":98},[70,724,329],{"class":87},[70,726,727,729,732,735,738,740,743,746],{"class":72,"line":122},[70,728,593],{"class":91},[70,730,731],{"class":87},": ",[70,733,734],{"class":76},"async",[70,736,737],{"class":87}," () ",[70,739,599],{"class":76},[70,741,742],{"class":87}," api.",[70,744,745],{"class":91},"fetchDraft",[70,747,748],{"class":87},"(userId),\n",[70,750,751],{"class":72,"line":142},[70,752,166],{"class":87},[17,754,755,756,239],{},"The form is fully usable while the factory is in flight; it holds the schema's slim defaults and exposes the load state through ",[21,757,685],{},[61,759,763],{"className":760,"code":761,"language":762,"meta":66,"style":66},"language-vue shiki shiki-themes github-light github-dark","\u003Cform :aria-busy=\"form.hydrating\">\n  \u003Cinput v-register=\"form.register('email')\" :disabled=\"form.hydrating\" \u002F>\n\u003C\u002Fform>\n","vue",[21,764,765,793,798],{"__ignoreMap":66},[70,766,767,770,774,777,780,783,786,788,790],{"class":72,"line":73},[70,768,769],{"class":87},"\u003C",[70,771,773],{"class":772},"s9eBZ","form",[70,775,776],{"class":87}," :",[70,778,779],{"class":91},"aria-busy",[70,781,782],{"class":87},"=",[70,784,785],{"class":157},"\"",[70,787,685],{"class":87},[70,789,785],{"class":157},[70,791,792],{"class":87},">\n",[70,794,795],{"class":72,"line":98},[70,796,797],{"class":87},"  \u003Cinput v-register=\"form.register('email')\" :disabled=\"form.hydrating\" \u002F>\n",[70,799,800,803,805],{"class":72,"line":122},[70,801,802],{"class":87},"\u003C\u002F",[70,804,773],{"class":772},[70,806,792],{"class":87},[17,808,809,810,812,813,816,817,619],{},"When the promise resolves the payload overlays onto storage, the same way a plain ",[21,811,35],{}," object would; ",[21,814,815],{},"hydrating"," flips back to ",[21,818,692],{},[17,820,821,822,825,826,829,830,833,834,837,838,840],{},"If the factory throws or rejects, the error lands on ",[21,823,824],{},"form.hydrateError"," as a ",[21,827,828],{},"ValidationError"," (",[21,831,832],{},"code: 'atta:hydration-failed'","). The same entry also surfaces through ",[21,835,836],{},"form.meta.errors",", so error UI can render off either surface. The form stays usable with the slim defaults; call ",[21,839,672],{}," to refire the captured factory, e.g. wired to a retry button.",[51,842],{"label":843,"slug":844},"Async factory demo","defaults-async-factory",[17,846,847,848,851],{},"Under SSR the factory fires via ",[21,849,850],{},"onServerPrefetch",", so the resolved payload bakes into the hydration transfer state; the client never re-fetches on hydrate.",[56,853,855],{"id":854},"numeric-leaves-auto-mark-blank","Numeric leaves auto-mark blank",[17,857,858,859,260,861,864,865,260,867,870,871,874],{},"Numeric primitives (",[21,860,128],{},[21,862,863],{},"bigint",") are special: when no explicit value is supplied, the leaf auto-marks as blank because storage's slim default (",[21,866,566],{},[21,868,869],{},"0n",") differs from what the DOM shows (an empty ",[21,872,873],{},"\u003Cinput type=\"number\">",").",[61,876,878],{"className":63,"code":877,"language":65,"meta":66,"style":66},"\u002F\u002F schema: z.object({ age: z.number(), title: z.string() })\nuseForm({ schema })\n\nform.values.age \u002F\u002F 0       ← storage slim default\nform.fields.age.blank \u002F\u002F true    ← auto-marked\nform.errors.age \u002F\u002F [{ code: 'atta:no-value-supplied', … }]\n\nform.values.title \u002F\u002F ''      ← storage slim default\nform.fields.title.blank \u002F\u002F false   ← NOT auto-marked (matches DOM)\nform.errors.title \u002F\u002F undefined  (z.string() accepts '')\n",[21,879,880,885,891,895,903,911,919,923,931,939],{"__ignoreMap":66},[70,881,882],{"class":72,"line":73},[70,883,884],{"class":203},"\u002F\u002F schema: z.object({ age: z.number(), title: z.string() })\n",[70,886,887,889],{"class":72,"line":98},[70,888,306],{"class":91},[70,890,189],{"class":87},[70,892,893],{"class":72,"line":122},[70,894,173],{"emptyLinePlaceholder":172},[70,896,897,900],{"class":72,"line":142},[70,898,899],{"class":87},"form.values.age ",[70,901,902],{"class":203},"\u002F\u002F 0       ← storage slim default\n",[70,904,905,908],{"class":72,"line":163},[70,906,907],{"class":87},"form.fields.age.blank ",[70,909,910],{"class":203},"\u002F\u002F true    ← auto-marked\n",[70,912,913,916],{"class":72,"line":169},[70,914,915],{"class":87},"form.errors.age ",[70,917,918],{"class":203},"\u002F\u002F [{ code: 'atta:no-value-supplied', … }]\n",[70,920,921],{"class":72,"line":176},[70,922,173],{"emptyLinePlaceholder":172},[70,924,925,928],{"class":72,"line":192},[70,926,927],{"class":87},"form.values.title ",[70,929,930],{"class":203},"\u002F\u002F ''      ← storage slim default\n",[70,932,933,936],{"class":72,"line":197},[70,934,935],{"class":87},"form.fields.title.blank ",[70,937,938],{"class":203},"\u002F\u002F false   ← NOT auto-marked (matches DOM)\n",[70,940,941,944],{"class":72,"line":207},[70,942,943],{"class":87},"form.errors.title ",[70,945,946],{"class":203},"\u002F\u002F undefined  (z.string() accepts '')\n",[17,948,949,950,952,953,955,956,958,959,963],{},"Strings and booleans don't auto-mark because their slim defaults match what the DOM natively shows. The schema is the authority on whether ",[21,951,655],{}," \u002F ",[21,954,692],{}," is acceptable; numerics need the side-channel to disambiguate \"user typed ",[21,957,566],{},"\" from \"user supplied nothing.\" See ",[517,960,520,961,531],{"href":527},[21,962,530],{}," for the full lifecycle.",[56,965,967,970,971,970,974],{"id":966},"defaultx-vs-prefaultx-vs-catchx",[21,968,969],{},".default(x)"," vs. ",[21,972,973],{},".prefault(x)",[21,975,976],{},".catch(x)",[17,978,979],{},"Zod offers three wrappers that influence the initial value:",[61,981,983],{"className":63,"code":982,"language":65,"meta":66,"style":66},"z.string().default('foo') \u002F\u002F pre-parse: used when input is undefined\nz.string().prefault('foo') \u002F\u002F same as default in Zod v4 (alias)\nz.string().catch('foo') \u002F\u002F post-parse fallback: used when parse fails\n",[21,984,985,1007,1027],{"__ignoreMap":66},[70,986,987,990,992,994,996,998,1001,1004],{"class":72,"line":73},[70,988,989],{"class":87},"z.",[70,991,148],{"class":91},[70,993,107],{"class":87},[70,995,110],{"class":91},[70,997,113],{"class":87},[70,999,1000],{"class":157},"'foo'",[70,1002,1003],{"class":87},") ",[70,1005,1006],{"class":203},"\u002F\u002F pre-parse: used when input is undefined\n",[70,1008,1009,1011,1013,1015,1018,1020,1022,1024],{"class":72,"line":98},[70,1010,989],{"class":87},[70,1012,148],{"class":91},[70,1014,107],{"class":87},[70,1016,1017],{"class":91},"prefault",[70,1019,113],{"class":87},[70,1021,1000],{"class":157},[70,1023,1003],{"class":87},[70,1025,1026],{"class":203},"\u002F\u002F same as default in Zod v4 (alias)\n",[70,1028,1029,1031,1033,1035,1038,1040,1042,1044],{"class":72,"line":122},[70,1030,989],{"class":87},[70,1032,148],{"class":91},[70,1034,107],{"class":87},[70,1036,1037],{"class":91},"catch",[70,1039,113],{"class":87},[70,1041,1000],{"class":157},[70,1043,1003],{"class":87},[70,1045,1046],{"class":203},"\u002F\u002F post-parse fallback: used when parse fails\n",[17,1048,1049,1050,1052,1053,1055,1056,1059,1060,1062],{},"For form defaults, you usually want ",[21,1051,969],{},"; it fills the slot before any user input lands. ",[21,1054,976],{}," is for recovery: if the schema would otherwise raise an error, fall back to ",[21,1057,1058],{},"x",". The adapter recognizes all three and feeds the initial value into ",[21,1061,27],{}," the same way; the difference shows up at parse time.",[56,1064,1066,970,1068],{"id":1065},"reset-vs-clear",[21,1067,31],{},[21,1069,1070],{},"clear()",[17,1072,1073],{},"The two operations look adjacent but mean different things:",[61,1075,1077],{"className":63,"code":1076,"language":65,"meta":66,"style":66},"const schema = z.object({\n  notify: z.boolean().default(true),\n  count: z.number().default(5),\n})\nconst form = useForm({ schema })\n\nform.reset() \u002F\u002F notify → true,  count → 5  (declared defaults)\nform.clear() \u002F\u002F notify → false, count → 0  (falsy-for-type)\n",[21,1078,1079,1093,1109,1126,1130,1142,1146,1158],{"__ignoreMap":66},[70,1080,1081,1083,1085,1087,1089,1091],{"class":72,"line":73},[70,1082,77],{"class":76},[70,1084,81],{"class":80},[70,1086,84],{"class":76},[70,1088,88],{"class":87},[70,1090,92],{"class":91},[70,1092,95],{"class":87},[70,1094,1095,1097,1099,1101,1103,1105,1107],{"class":72,"line":98},[70,1096,101],{"class":87},[70,1098,104],{"class":91},[70,1100,107],{"class":87},[70,1102,110],{"class":91},[70,1104,113],{"class":87},[70,1106,116],{"class":80},[70,1108,119],{"class":87},[70,1110,1111,1113,1115,1117,1119,1121,1124],{"class":72,"line":122},[70,1112,125],{"class":87},[70,1114,128],{"class":91},[70,1116,107],{"class":87},[70,1118,110],{"class":91},[70,1120,113],{"class":87},[70,1122,1123],{"class":80},"5",[70,1125,119],{"class":87},[70,1127,1128],{"class":72,"line":142},[70,1129,166],{"class":87},[70,1131,1132,1134,1136,1138,1140],{"class":72,"line":163},[70,1133,77],{"class":76},[70,1135,181],{"class":80},[70,1137,84],{"class":76},[70,1139,186],{"class":91},[70,1141,189],{"class":87},[70,1143,1144],{"class":72,"line":169},[70,1145,173],{"emptyLinePlaceholder":172},[70,1147,1148,1150,1152,1155],{"class":72,"line":176},[70,1149,249],{"class":87},[70,1151,280],{"class":91},[70,1153,1154],{"class":87},"() ",[70,1156,1157],{"class":203},"\u002F\u002F notify → true,  count → 5  (declared defaults)\n",[70,1159,1160,1162,1165,1167],{"class":72,"line":192},[70,1161,249],{"class":87},[70,1163,1164],{"class":91},"clear",[70,1166,1154],{"class":87},[70,1168,1169],{"class":203},"\u002F\u002F notify → false, count → 0  (falsy-for-type)\n",[17,1171,1172,1174,1175,1177,1178,1180,1181,1184,1185,1188],{},[21,1173,280],{}," re-applies the schema's declared ",[21,1176,23],{}," values; ",[21,1179,1164],{}," ignores them and writes the type's falsy concrete instead. Both accept a path argument: ",[21,1182,1183],{},"resetField(path)"," re-seeds one leaf, ",[21,1186,1187],{},"clear(path?)"," wipes one or the whole form.",[17,1190,1191,1192,1194,1195,619],{},"For \"wipe to blank state\" UX, prefer ",[21,1193,1164],{},". For \"back to the form's starting state\" UX, prefer ",[21,1196,280],{},[56,1198,1200],{"id":1199},"where-to-next","Where to next",[1202,1203,1204,1212,1219],"ul",{},[1205,1206,1207,1211],"li",{},[517,1208,1210],{"href":1209},"\u002Fdocs\u002Fschemas\u002Fstorage-shape","How values are stored",": the slim write shape and the read vs. write vs. submit distinction.",[1205,1213,1214,1218],{},[517,1215,1217],{"href":1216},"\u002Fdocs\u002Fschemas\u002Foptional-nullable","Optional, nullable, defaulted",": what each missing-ness modifier means for the initial value.",[1205,1220,1221,1230],{},[517,1222,1224,1226,1227],{"href":1223},"\u002Fdocs\u002Fwriting-and-mutating\u002Freset",[21,1225,280],{}," & ",[21,1228,1229],{},"resetField",": the imperative surface that re-applies defaults.",[1232,1233,1234],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}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 .s9eBZ, html code.shiki .s9eBZ{--shiki-default:#22863A;--shiki-dark:#85E89D}",{"title":66,"searchDepth":98,"depth":98,"links":1236},[1237,1238,1240,1242,1243,1244,1245,1247,1249],{"id":58,"depth":98,"text":59},{"id":293,"depth":98,"text":1239},"Per-form defaultValues overlay",{"id":382,"depth":98,"text":1241},"Three patterns for defaultValues",{"id":535,"depth":98,"text":536},{"id":696,"depth":98,"text":697},{"id":854,"depth":98,"text":855},{"id":966,"depth":98,"text":1246},".default(x) vs. .prefault(x) vs. .catch(x)",{"id":1065,"depth":98,"text":1248},"reset() vs. clear()",{"id":1199,"depth":98,"text":1200},"Schema-declared defaults flow into form.values at mount and on reset. defaultValues overlays them; unset opts a leaf back to blank. The schema is the source of truth.","md",{},[1254,1257,1260,1263],{"label":1255,"value":1256},"Category","Conceptual",{"label":1258,"value":1259,"kind":21},"Declared on schema","z.string().default(x), z.number().default(n)",{"label":1261,"value":1262,"kind":21},"Overlaid per form","useForm({ defaultValues })",{"label":1264,"value":1265,"kind":21},"Re-applied by","form.reset()","\u002Fdocs\u002Fschemas\u002Fdefaults",{"title":5,"description":1250},null,"docs\u002Fschemas\u002Fdefaults","tQJNFqIPlA7vYsQfNNWKj9_iJjgWm5nzB7ztpAp8S68",1780949757459]