[{"data":1,"prerenderedAt":451},["ShallowReactive",2],{"content-\u002Fdocs\u002Fwriting-and-mutating\u002Fclear":3},{"id":4,"title":5,"body":6,"description":430,"extension":431,"meta":432,"metaRows":433,"navigation":445,"path":446,"seo":447,"source":448,"stem":449,"__hash__":450},"docs\u002Fdocs\u002Fwriting-and-mutating\u002Fclear.md","clear & blank values",{"type":7,"value":8,"toc":420},"minimark",[9,18,25,28,55,59,64,74,176,191,195,207,247,258,262,322,329,336,345,352,365,375,379,416],[10,11,13,17],"h1",{"id":12},"clear-blank-values",[14,15,16],"code",{},"clear"," & blank values",[19,20,21],"blockquote",{},[22,23,24],"p",{},"Wipe to the schema's empty shape, not to defaults. For \"blank canvas\" UX where defaults would be the wrong destination.",[26,27],"docs-meta-table",{},[22,29,30,31,34,35,38,39,42,43,46,47,50,51,54],{},"Click the per-field clear buttons to watch each path drop to its schema-slim empty value: ",[14,32,33],{},"''"," for the string title, ",[14,36,37],{},"[]"," for the tags array, ",[14,40,41],{},"false"," for the published boolean. Click ",[14,44,45],{},"clear()"," to wipe everything. The defaults declared on ",[14,48,49],{},"useForm"," are intentionally skipped; that's the distinction from ",[14,52,53],{},"reset",". The blank flag on each field flips on to mark the cleared state.",[56,57],"docs-demo",{"label":58,"slug":16},"Clear Demo",[60,61,63],"h2",{"id":62},"what-blank-means","What \"blank\" means",[22,65,66,68,69,73],{},[14,67,16],{}," writes the ",[70,71,72],"strong",{},"schema-slim"," empty value at each cleared path:",[75,76,77,90],"table",{},[78,79,80],"thead",{},[81,82,83,87],"tr",{},[84,85,86],"th",{},"Leaf type",[84,88,89],{},"Cleared value",[91,92,93,105,117,128,139,152,164],"tbody",{},[81,94,95,101],{},[96,97,98],"td",{},[14,99,100],{},"z.string()",[96,102,103],{},[14,104,33],{},[81,106,107,112],{},[96,108,109],{},[14,110,111],{},"z.number()",[96,113,114],{},[14,115,116],{},"0",[81,118,119,124],{},[96,120,121],{},[14,122,123],{},"z.boolean()",[96,125,126],{},[14,127,41],{},[81,129,130,135],{},[96,131,132],{},[14,133,134],{},"z.array()",[96,136,137],{},[14,138,37],{},[81,140,141,146],{},[96,142,143],{},[14,144,145],{},"z.object()",[96,147,148,151],{},[14,149,150],{},"{}"," (then descended)",[81,153,154,159],{},[96,155,156],{},[14,157,158],{},"z.date()",[96,160,161],{},[14,162,163],{},"new Date(0)",[81,165,166,171],{},[96,167,168],{},[14,169,170],{},"z.file()",[96,172,173],{},[14,174,175],{},"null",[22,177,178,179,182,183,186,187,190],{},"Same shapes Attaform uses for the initial defaults when nothing is declared in ",[14,180,181],{},"defaultValues"," or ",[14,184,185],{},"schema.default(...)",". The blank predicate (",[14,188,189],{},"fields.\u003Cpath>.blank",") flips true at every cleared path.",[60,192,194],{"id":193},"clear-is-not-reset","Clear is not reset",[22,196,197,198,200,201,203,204,206],{},"The key distinction: ",[14,199,16],{}," skips defaults; ",[14,202,53],{}," restores them. Pick clear when the user-facing intent is \"blank canvas\": a fresh draft, a wipe, a \"start over from nothing\". Pick ",[14,205,53],{}," when the intent is \"back to baseline\": the form's authoritative starting state.",[208,209,214],"pre",{"className":210,"code":211,"language":212,"meta":213,"style":213},"language-ts shiki shiki-themes github-light github-dark","form.reset() \u002F\u002F values.title === 'A great draft'  (the default)\nform.clear() \u002F\u002F values.title === ''  (the schema-slim empty)\n","ts","",[14,215,216,235],{"__ignoreMap":213},[217,218,221,225,228,231],"span",{"class":219,"line":220},"line",1,[217,222,224],{"class":223},"sVt8B","form.",[217,226,53],{"class":227},"sScJk",[217,229,230],{"class":223},"() ",[217,232,234],{"class":233},"sJ8bj","\u002F\u002F values.title === 'A great draft'  (the default)\n",[217,236,238,240,242,244],{"class":219,"line":237},2,[217,239,224],{"class":223},[217,241,16],{"class":227},[217,243,230],{"class":223},[217,245,246],{"class":233},"\u002F\u002F values.title === ''  (the schema-slim empty)\n",[22,248,249,250,253,254,257],{},"Both wipe ",[14,251,252],{},"dirty"," \u002F ",[14,255,256],{},"touched"," along with the value; both surface the same reactive pipeline.",[60,259,261],{"id":260},"three-call-shapes","Three call shapes",[208,263,265],{"className":210,"code":264,"language":212,"meta":213,"style":213},"form.clear() \u002F\u002F whole form\nform.clear('profile.email') \u002F\u002F dotted path\nform.clear(['profile', 'email']) \u002F\u002F segment tuple\n",[14,266,267,278,297],{"__ignoreMap":213},[217,268,269,271,273,275],{"class":219,"line":220},[217,270,224],{"class":223},[217,272,16],{"class":227},[217,274,230],{"class":223},[217,276,277],{"class":233},"\u002F\u002F whole form\n",[217,279,280,282,284,287,291,294],{"class":219,"line":237},[217,281,224],{"class":223},[217,283,16],{"class":227},[217,285,286],{"class":223},"(",[217,288,290],{"class":289},"sZZnC","'profile.email'",[217,292,293],{"class":223},") ",[217,295,296],{"class":233},"\u002F\u002F dotted path\n",[217,298,300,302,304,307,310,313,316,319],{"class":219,"line":299},3,[217,301,224],{"class":223},[217,303,16],{"class":227},[217,305,306],{"class":223},"([",[217,308,309],{"class":289},"'profile'",[217,311,312],{"class":223},", ",[217,314,315],{"class":289},"'email'",[217,317,318],{"class":223},"]) ",[217,320,321],{"class":233},"\u002F\u002F segment tuple\n",[22,323,324,325,328],{},"Same call ergonomics as ",[14,326,327],{},"setValue",". The whole-form call clears every path recursively; the per-path forms scope to one leaf or container.",[60,330,332,333],{"id":331},"returns-boolean","Returns ",[14,334,335],{},"boolean",[22,337,338,341,342,344],{},[14,339,340],{},"true"," on accepted writes, ",[14,343,41],{}," when the slim-type gate rejects (rare; the empty value should always be valid for the path's accept set, but containers with required fields may flag).",[60,346,348,349,351],{"id":347},"when-clear-is-the-right-call","When ",[14,350,45],{}," is the right call",[353,354,355,359,362],"ul",{},[356,357,358],"li",{},"A \"Compose new\" button in a draft UI where the user expects an empty canvas, not a re-populated form.",[356,360,361],{},"After a successful submit when the next interaction should start from nothing rather than the previous defaults.",[356,363,364],{},"Implementing a \"Discard and start over\" affordance distinct from \"Undo my edits\".",[22,366,367,368,374],{},"For \"go back to the baseline this form was hydrated with,\" reach for ",[369,370,372],"a",{"href":371},"\u002Fdocs\u002Fwriting-and-mutating\u002Freset",[14,373,53],{}," instead.",[60,376,378],{"id":377},"where-to-next","Where to next",[353,380,381,392,409],{},[356,382,383,391],{},[369,384,385,387,388],{"href":371},[14,386,53],{}," & ",[14,389,390],{},"resetField",": restore defaults instead of clearing.",[356,393,394,400,401,312,403,405,406,408],{},[369,395,397],{"href":396},"\u002Fdocs\u002Fwriting-and-mutating\u002Funset",[14,398,399],{},"unset",": flag any path blank in ",[14,402,181],{},[14,404,327],{},", or ",[14,407,53],{},".",[356,410,411,415],{},[369,412,414],{"href":413},"\u002Fdocs\u002Fvalidation\u002Fshowing-errors","Display state and showing errors",": how blank fields interact with the error-display predicate.",[417,418,419],"style",{},"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 .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 .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}",{"title":213,"searchDepth":237,"depth":237,"links":421},[422,423,424,425,427,429],{"id":62,"depth":237,"text":63},{"id":193,"depth":237,"text":194},{"id":260,"depth":237,"text":261},{"id":331,"depth":237,"text":426},"Returns boolean",{"id":347,"depth":237,"text":428},"When clear() is the right call",{"id":377,"depth":237,"text":378},"clear writes the schema-slim empty value at one path or the whole form, `''` for strings, `0` for numbers, `[]` for arrays, `false` for booleans. Defaults are intentionally skipped.","md",{},[434,437,440,443],{"label":435,"value":436},"Category","Return method",{"label":438,"value":439,"kind":14},"Signatures","clear() · clear(path) · clear(segments)",{"label":441,"value":442},"Writes","schema-slim empty value",{"label":444,"value":335,"kind":14},"Returns",true,"\u002Fdocs\u002Fwriting-and-mutating\u002Fclear",{"title":5,"description":430},null,"docs\u002Fwriting-and-mutating\u002Fclear","MzZw-sjaqTEBZnnEdViLZu6p3wEGoDucSwUn1rWW9qc",1780949759806]