[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69B8NWFPN517W6WRNHBRJRA":3,"skill-same:01M69B8NWFPN517W6WRNHBRJRA":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M69B8NWFPN517W6WRNHBRJRA","reactor-forms",null,"Reactor forms and validation — `UseValidationContext`, built-in validators (`Validate.Required`, `Validate.Email`, `Validate.MinLength`, etc.), `FormField` helper, masked input via `MaskEngine`, `InputFormatter`. Use when building data-entry screens, validation flows, or controlled-input forms.","microsoft\u002Fmicrosoft-ui-reactor","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69B6EF21X2GHARCXN2BH1K1",896,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fplugins\u002Freactor\u002Fskills\u002Freactor-forms\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31],"reactor forms","forms","validate","validation","email","data","use","input","via","helper","flows","entry","when","2026-11-10 10:12:30",false,"---\nname: reactor-forms\ndescription: \"Reactor forms and validation — `UseValidationContext`, built-in validators (`Validate.Required`, `Validate.Email`, `Validate.MinLength`, etc.), `FormField` helper, masked input via `MaskEngine`, `InputFormatter`. Use when building data-entry screens, validation flows, or controlled-input forms.\"\n---\n\n# Forms and Validation in Reactor\n\nReactor forms use a **controlled-input pattern** — every input has an\nexplicit `(value, setter)` pair driven by `UseState`. There is no two-way\nbinding. Validation is layered on top via `UseValidationContext` and\ndeclarative `.Validate()` modifiers.\n\n\n> **Controlled prop note:** factory call sites keep the plain `(value,\n> setter)` shape, but the underlying element records use `Optional\u003CT>`.\n> Read element props with `.Value` \u002F `.GetValueOrDefault(...)`; use\n> `Optional\u003CT>.Unset` only when the WinUI control should own the value. See\n> [`migration\u002F050-optional-t.md`](..\u002F..\u002F..\u002F..\u002Fdocs\u002Fguide\u002Fmigration\u002F050-optional-t.md).\n\n## Quick reference\n\n| API | Purpose |\n|-----|---------|\n| `TextBox(value, setValue)` | Controlled text input |\n| `UseValidationContext()` | Track validation messages, touched\u002Fdirty state |\n| `.Validate(...)` | Attach built-in validators to an input |\n| `FormField(input, label: ...)` | Wraps input with label, error display, required marker |\n| `new MaskEngine(...)` | Masked text input (phone, SSN, etc.) |\n| `InputFormatter.Currency(...)` | Format-as-you-type |\n\n## 1. Controlled inputs\n\nEvery input takes `(value, setter)`. State lives in the component:\n\n```csharp\nvar (name, setName) = UseState(\"\");\nvar (age, setAge) = UseState(0);\nvar (agreed, setAgreed) = UseState(false);\n\nreturn VStack(12,\n    TextBox(name, setName, placeholderText: \"Name\"),\n    NumberBox(age, setAge),\n    CheckBox(agreed, setAgreed, label: \"I agree\"),\n    Button(\"Submit\", onSubmit).IsEnabled(!(string.IsNullOrEmpty(name) || !agreed))\n);\n```\n\n### Available input types\n\n| Factory | Value type | Common modifiers |\n|---------|-----------|------------------|\n| `TextBox(value, setValue, placeholderText, header)` | `string` | `.Header()`, `.IsReadOnly()`, `.AcceptsReturn()`, `.TextWrapping()`, `.MaxLength(n)`, `.NumericInput()`, `.EmailInput()`, `.Changed(handler)` |\n| `PasswordBox(password, setPassword, placeholderText)` | `string` | `.Header(text)`, `.MaxLength(n)`, `.PasswordChanged(handler)` |\n| `NumberBox(value, setValue, header)` | `double` | `.PlaceholderText(text)`, `.Range(min, max)`, `.SpinButtons(...)` |\n| `Slider(value, min, max, setValue)` | `double` | `.Header()`, `.StepFrequency()` |\n| `ToggleSwitch(isOn, setIsOn, header, onContent, offContent)` | `bool` | `.Header()` |\n| `CheckBox(isChecked, setIsChecked, label)` | `bool` | — |\n| `RadioButtons(items, selected, setSelected, header)` | `int` | `.Set(rb => ...)` |\n| `ComboBox(items, selected, setSelected)` | `object` | `.Header()`, `.IsEditable()`, `.PlaceholderText(text)` |\n| `DatePicker(date, setDate, header)` | `DateTimeOffset` | `.Set(dp => ...)` |\n| `TimePicker(time, setTime, header)` | `TimeSpan` | `.Set(tp => ...)` |\n| `AutoSuggestBox(text, setText, onQuerySubmitted)` | `string` | `.PlaceholderText(text)`, `.Set(asb => ...)` |\n| `RichEditBox(doc, setDoc, header)` | `string` | `.PlaceholderText(text)`, `.Set(reb => ...)` |\n| `CalendarDatePicker(date, setDate)` | `DateTimeOffset?` | `.PlaceholderText(text)`, `.Set(cdp => ...)` |\n\n**Named-input shapes** (Spec 039 §17.3): `.NumericInput()` \u002F `.EmailInput()`\npreconfigure `InputScope` and IME hints so on-screen \u002F soft keyboards open\nin the right mode. Stack them with validators:\n\n```csharp\nTextBox(email, setEmail, placeholderText: \"you@example.com\")\n    .EmailInput()\n    .MaxLength(254)\n    .Validate(\"email\", email, Validate.Required(), Validate.Email())\n```\n\nFor modifiers that aren't in the typed surface (e.g. `PasswordRevealMode`,\ndate min\u002Fmax), use `.Set(native => ...)` to reach the underlying WinUI control.\nThe full catalog is in `references\u002Freactor.api.txt`.\n\n## 2. Simple validation (derived booleans)\n\nFor trivial forms, derive validation from state:\n\n```csharp\nvar (email, setEmail) = UseState(\"\");\nvar isValid = email.Contains('@') && email.Length > 3;\n\nreturn VStack(12,\n    TextBox(email, setEmail, placeholderText: \"Email\"),\n    Button(\"Submit\", onSubmit).IsEnabled(isValid)\n);\n```\n\nThis is fine for 1–2 fields. For anything more, use `UseValidationContext`.\n\n## 3. UseValidationContext\n\nTracks per-field validation messages, touched\u002Fdirty state, and overall\nform validity:\n\n```csharp\nvar validation = this.UseValidationContext();\nvar (name, setName) = UseState(\"\");\nvar (email, setEmail) = UseState(\"\");\n\nreturn VStack(12,\n    TextBox(name, setName, placeholderText: \"Name\")\n        .Validate(\"name\", name,\n            Validate.Required(\"Name is required\"),\n            Validate.MinLength(2, \"Name too short\")),\n\n    TextBox(email, setEmail, placeholderText: \"Email\")\n        .Validate(\"email\", email,\n            Validate.Required(\"Email is required\"),\n            Validate.Email(\"Invalid email\")),\n\n    Button(\"Submit\", () =>\n    {\n        validation.MarkAllTouched();\n        if (validation.IsValid())\n            Submit(name, email);\n    })\n);\n```\n\n`.Validate(fieldName, value, ...)` resolves the surrounding `ValidationContext`\nthrough React-style ambient context — you do not pass `validation` explicitly.\nPassing the current value (the second arg) runs the validators right there,\nduring the render, so a `When(validation.HasError(\"email\"), ...)` placed *after*\nthe field reads the result in the same pass rather than one render late. The\nvalidator-only overload `.Validate(fieldName, ...)` has no value to check, so it\nonly records the validators: nothing runs them, and on a bare control nothing\nregisters the field either. Inside a `FormField` the field is registered on\nmount, so `MarkAllTouched()` covers it.\n\nYou do not need `.Provide(ValidationContexts.Current, validation)`: a\ncomponent-local context is published to the rendered subtree automatically, so\n`FormField`, `ValidationVisualizer`, and nested components find it. Providing one\nexplicitly is what *descendants* resolve, but it does not redirect the providing\ncomponent's own `.Validate()` calls — those already ran while the tree was being\nbuilt. To pool several components' fields into one context, provide it from a\nparent and let each child call `UseValidationContext()`.\n\nMutating the context re-renders the component that created it. That is why\n`MarkAllTouched()` alone reveals the errors on a failed submit, even though no\ncomponent state changed.\n\n### ValidationContext API\n\n| Member | Purpose |\n|--------|---------|\n| `.IsValid()` | `true` when no field has Error-severity messages |\n| `.IsDirty()` | `true` when any registered field differs from initial value |\n| `.IsDirty(\"field\")` | Per-field dirty check |\n| `.MarkAllTouched()` | Mark every registered field touched (typical on submit) |\n| `.MarkTouched(\"field\")` | Mark a single field touched |\n| `.Reset(\"field\")` | Reset one field to initial value, returns the initial |\n| `.ResetAll()` | Reset all fields to initial values |\n| `.ClearAll()` | Clear all messages (preserve touched\u002Finitial state) |\n| `.GetMessages(\"field\")` | Get error messages for a specific field |\n| `.IsTouched(\"field\")` | Whether the user has interacted with a field |\n| `.Changed` | Event raised when the context's observable state changes |\n\n## 4. Built-in validators\n\nThe `.Validate()` modifier accepts an array of validators:\n\n| Validator | Purpose |\n|-----------|---------|\n| `Validate.Required(msg)` | Non-empty |\n| `Validate.MinLength(n, msg)` | Minimum string length |\n| `Validate.MaxLength(n, msg)` | Maximum string length |\n| `Validate.Email(msg)` | Email format |\n| `Validate.Match(pattern, msg)` | Custom regex pattern |\n| `Validate.Range(min, max, msg)` | Numeric range |\n| `Validate.Must\u003CT>(predicate, msg)` | Arbitrary predicate |\n| `Validate.EqualTo\u003CT>(value, msg)` | Fields must match (confirm password) |\n| `Validate.Url(msg)` | URL format |\n| `Validate.MustBeTrue(msg)` | Boolean must be true (checkboxes) |\n\n## 5. FormField helper\n\n`FormField` wraps an input with a label, required marker, description\ntext, and error display:\n\n```csharp\nvar validation = this.UseValidationContext();\nvar (name, setName) = UseState(\"\");\n\nreturn FormField(\n    TextBox(name, setName, placeholderText: \"Enter your name\")\n        .Validate(\"name\", name, Validate.Required(\"Required\")),\n    label: \"Full Name\",\n    required: true,\n    description: \"As it appears on your ID\",\n    showWhen: ShowWhen.WhenTouched  \u002F\u002F or Always, WhenDirty, AfterFirstSubmit, Never\n);\n```\n\n`ShowWhen` controls when error messages appear:\n- `WhenTouched` — after the user has interacted with the field (recommended default).\n  `FormField` marks its own field touched on blur; elsewhere call `MarkTouched`.\n- `Always` — immediately, even before user interaction\n- `WhenDirty` — only after the value has changed from its baseline. Requires\n  `SetInitialValue(field, value)`: with no baseline recorded a field is never\n  dirty, so this policy stays silent forever.\n- `AfterFirstSubmit` — only after the first submit attempt, which is\n  `MarkAllTouched()`. `ResetAll()` clears it, so the next reveal waits for a\n  fresh submit.\n\nThe verdict itself is unaffected by any of these — `IsValid()` and\n`GetMessages()` are current from the first render. `ShowWhen` only gates display.\n\n## 6. Masked input\n\n`MaskEngine` restricts and formats input as the user types:\n\n```csharp\nvar mask = UseMemo(() => new MaskEngine(MaskPreset.PhoneUS));\nvar (phone, setPhone) = UseState(\"\");\n\nreturn TextBox(phone, v => setPhone(mask.Apply(v)),\n    placeholderText: \"(555) 555-0123\");\n```\n\n### Mask presets\n\n| Preset | Format |\n|--------|--------|\n| `MaskPreset.PhoneUS` | `(___) ___-____` |\n| `MaskPreset.SSN` | `___-__-____` |\n| `MaskPreset.ZipCode` | `_____` |\n| `MaskPreset.ZipCodePlus4` | `_____-____` |\n| `MaskPreset.CreditCard` | `____ ____ ____ ____` |\n| `MaskPreset.Date` | `__\u002F__\u002F____` |\n\nCustom masks: `new MaskEngine(\"AA-####\")` where `A` = letter,\n`#` = digit, `*` = any.\n\n## 7. Input formatters\n\n`InputFormatter` applies format-as-you-type transformations:\n\n```csharp\nvar (amount, setAmount) = UseState(\"\");\n\nreturn TextBox(amount,\n    v => setAmount(InputFormatter.Currency(symbol: \"$\").Format(v)),\n    placeholderText: \"$0.00\");\n```\n\n| Formatter | Effect |\n|----------|--------|\n| `InputFormatter.Currency(symbol: \"$\")` | `$1,234.56` |\n| `InputFormatter.PhoneUS` | `(555) 555-0123` |\n| `InputFormatter.UpperCase` | Force uppercase |\n| `InputFormatter.LowerCase` | Force lowercase |\n| `InputFormatter.TitleCase` | Title Case |\n| `InputFormatter.MaxLength(n)` | Truncate at n chars |\n| `InputFormatter.AllowOnly(regex)` | Whitelist characters |\n\n## Critical gotchas\n\n1. **Always use controlled inputs** — `(value, setter)` pair. There is no\n   uncontrolled \u002F two-way binding in Reactor.\n2. **Call `validation.MarkAllTouched()` before submit** — when fields use the\n   `.Validate(name, value, ...)` form, validators run automatically every\n   render, but errors stay hidden until each field is touched. Mark all\n   registered fields touched on submit so error messages reveal at once,\n   then gate on `validation.IsValid()`.\n3. **Use `ShowWhen.WhenTouched`** (default) — showing errors immediately on\n   page load is hostile UX.\n4. **MaskEngine and InputFormatter are different** — masks restrict what\n   characters can be entered; formatters transform the display.\n5. **Don't mix simple validation and UseValidationContext** — pick one\n   approach per form.\n6. **FormField handles layout and error display** — don't manually build\n   error message TextBlocks when using FormField.\n","# Forms and Validation in Reactor\n\nReactor forms use a **controlled-input pattern** — every input has an\nexplicit `(value, setter)` pair driven by `UseState`. There is no two-way\nbinding. Validation is layered on top via `UseValidationContext` and\ndeclarative `.Validate()` modifiers.\n\n\n> **Controlled prop note:** factory call sites keep the plain `(value,\n> setter)` shape, but the underlying element records use `Optional\u003CT>`.\n> Read element props with `.Value` \u002F `.GetValueOrDefault(...)`; use\n> `Optional\u003CT>.Unset` only when the WinUI control should own the value. See\n> [`migration\u002F050-optional-t.md`](..\u002F..\u002F..\u002F..\u002Fdocs\u002Fguide\u002Fmigration\u002F050-optional-t.md).\n\n## Quick reference\n\n| API | Purpose |\n|-----|---------|\n| `TextBox(value, setValue)` | Controlled text input |\n| `UseValidationContext()` | Track validation messages, touched\u002Fdirty state |\n| `.Validate(...)` | Attach built-in validators to an input |\n| `FormField(input, label: ...)` | Wraps input with label, error display, required marker |\n| `new MaskEngine(...)` | Masked text input (phone, SSN, etc.) |\n| `InputFormatter.Currency(...)` | Format-as-you-type |\n\n## 1. Controlled inputs\n\nEvery input takes `(value, setter)`. State lives in the component:\n\n```csharp\nvar (name, setName) = UseState(\"\");\nvar (age, setAge) = UseState(0);\nvar (agreed, setAgreed) = UseState(false);\n\nreturn VStack(12,\n    TextBox(name, setName, placeholderText: \"Name\"),\n    NumberBox(age, setAge),\n    CheckBox(agreed, setAgreed, label: \"I agree\"),\n    Button(\"Submit\", onSubmit).IsEnabled(!(string.IsNullOrEmpty(name) || !agreed))\n);\n```\n\n### Available input types\n\n| Factory | Value type | Common modifiers |\n|---------|-----------|------------------|\n| `TextBox(value, setValue, placeholderText, header)` | `string` | `.Header()`, `.IsReadOnly()`, `.AcceptsReturn()`, `.TextWrapping()`, `.MaxLength(n)`, `.NumericInput()`, `.EmailInput()`, `.Changed(handler)` |\n| `PasswordBox(password, setPassword, placeholderText)` | `string` | `.Header(text)`, `.MaxLength(n)`, `.PasswordChanged(handler)` |\n| `NumberBox(value, setValue, header)` | `double` | `.PlaceholderText(text)`, `.Range(min, max)`, `.SpinButtons(...)` |\n| `Slider(value, min, max, setValue)` | `double` | `.Header()`, `.StepFrequency()` |\n| `ToggleSwitch(isOn, setIsOn, header, onContent, offContent)` | `bool` | `.Header()` |\n| `CheckBox(isChecked, setIsChecked, label)` | `bool` | — |\n| `RadioButtons(items, selected, setSelected, header)` | `int` | `.Set(rb => ...)` |\n| `ComboBox(items, selected, setSelected)` | `object` | `.Header()`, `.IsEditable()`, `.PlaceholderText(text)` |\n| `DatePicker(date, setDate, header)` | `DateTimeOffset` | `.Set(dp => ...)` |\n| `TimePicker(time, setTime, header)` | `TimeSpan` | `.Set(tp => ...)` |\n| `AutoSuggestBox(text, setText, onQuerySubmitted)` | `string` | `.PlaceholderText(text)`, `.Set(asb => ...)` |\n| `RichEditBox(doc, setDoc, header)` | `string` | `.PlaceholderText(text)`, `.Set(reb => ...)` |\n| `CalendarDatePicker(date, setDate)` | `DateTimeOffset?` | `.PlaceholderText(text)`, `.Set(cdp => ...)` |\n\n**Named-input shapes** (Spec 039 §17.3): `.NumericInput()` \u002F `.EmailInput()`\npreconfigure `InputScope` and IME hints so on-screen \u002F soft keyboards open\nin the right mode. Stack them with validators:\n\n```csharp\nTextBox(email, setEmail, placeholderText: \"you@example.com\")\n    .EmailInput()\n    .MaxLength(254)\n    .Validate(\"email\", email, Validate.Required(), Validate.Email())\n```\n\nFor modifiers that aren't in the typed surface (e.g. `PasswordRevealMode`,\ndate min\u002Fmax), use `.Set(native => ...)` to reach the underlying WinUI control.\nThe full catalog is in `references\u002Freactor.api.txt`.\n\n## 2. Simple validation (derived booleans)\n\nFor trivial forms, derive validation from state:\n\n```csharp\nvar (email, setEmail) = UseState(\"\");\nvar isValid = email.Contains('@') && email.Length > 3;\n\nreturn VStack(12,\n    TextBox(email, setEmail, placeholderText: \"Email\"),\n    Button(\"Submit\", onSubmit).IsEnabled(isValid)\n);\n```\n\nThis is fine for 1–2 fields. For anything more, use `UseValidationContext`.\n\n## 3. UseValidationContext\n\nTracks per-field validation messages, touched\u002Fdirty state, and overall\nform validity:\n\n```csharp\nvar validation = this.UseValidationContext();\nvar (name, setName) = UseState(\"\");\nvar (email, setEmail) = UseState(\"\");\n\nreturn VStack(12,\n    TextBox(name, setName, placeholderText: \"Name\")\n        .Validate(\"name\", name,\n            Validate.Required(\"Name is required\"),\n            Validate.MinLength(2, \"Name too short\")),\n\n    TextBox(email, setEmail, placeholderText: \"Email\")\n        .Validate(\"email\", email,\n            Validate.Required(\"Email is required\"),\n            Validate.Email(\"Invalid email\")),\n\n    Button(\"Submit\", () =>\n    {\n        validation.MarkAllTouched();\n        if (validation.IsValid())\n            Submit(name, email);\n    })\n);\n```\n\n`.Validate(fieldName, value, ...)` resolves the surrounding `ValidationContext`\nthrough React-style ambient context — you do not pass `validation` explicitly.\nPassing the current value (the second arg) runs the validators right there,\nduring the render, so a `When(validation.HasError(\"email\"), ...)` placed *after*\nthe field reads the result in the same pass rather than one render late. The\nvalidator-only overload `.Validate(fieldName, ...)` has no value to check, so it\nonly records the validators: nothing runs them, and on a bare control nothing\nregisters the field either. Inside a `FormField` the field is registered on\nmount, so `MarkAllTouched()` covers it.\n\nYou do not need `.Provide(ValidationContexts.Current, validation)`: a\ncomponent-local context is published to the rendered subtree automatically, so\n`FormField`, `ValidationVisualizer`, and nested components find it. Providing one\nexplicitly is what *descendants* resolve, but it does not redirect the providing\ncomponent's own `.Validate()` calls — those already ran while the tree was being\nbuilt. To pool several components' fields into one context, provide it from a\nparent and let each child call `UseValidationContext()`.\n\nMutating the context re-renders the component that created it. That is why\n`MarkAllTouched()` alone reveals the errors on a failed submit, even though no\ncomponent state changed.\n\n### ValidationContext API\n\n| Member | Purpose |\n|--------|---------|\n| `.IsValid()` | `true` when no field has Error-severity messages |\n| `.IsDirty()` | `true` when any registered field differs from initial value |\n| `.IsDirty(\"field\")` | Per-field dirty check |\n| `.MarkAllTouched()` | Mark every registered field touched (typical on submit) |\n| `.MarkTouched(\"field\")` | Mark a single field touched |\n| `.Reset(\"field\")` | Reset one field to initial value, returns the initial |\n| `.ResetAll()` | Reset all fields to initial values |\n| `.ClearAll()` | Clear all messages (preserve touched\u002Finitial state) |\n| `.GetMessages(\"field\")` | Get error messages for a specific field |\n| `.IsTouched(\"field\")` | Whether the user has interacted with a field |\n| `.Changed` | Event raised when the context's observable state changes |\n\n## 4. Built-in validators\n\nThe `.Validate()` modifier accepts an array of validators:\n\n| Validator | Purpose |\n|-----------|---------|\n| `Validate.Required(msg)` | Non-empty |\n| `Validate.MinLength(n, msg)` | Minimum string length |\n| `Validate.MaxLength(n, msg)` | Maximum string length |\n| `Validate.Email(msg)` | Email format |\n| `Validate.Match(pattern, msg)` | Custom regex pattern |\n| `Validate.Range(min, max, msg)` | Numeric range |\n| `Validate.Must\u003CT>(predicate, msg)` | Arbitrary predicate |\n| `Validate.EqualTo\u003CT>(value, msg)` | Fields must match (confirm password) |\n| `Validate.Url(msg)` | URL format |\n| `Validate.MustBeTrue(msg)` | Boolean must be true (checkboxes) |\n\n## 5. FormField helper\n\n`FormField` wraps an input with a label, required marker, description\ntext, and error display:\n\n```csharp\nvar validation = this.UseValidationContext();\nvar (name, setName) = UseState(\"\");\n\nreturn FormField(\n    TextBox(name, setName, placeholderText: \"Enter your name\")\n        .Validate(\"name\", name, Validate.Required(\"Required\")),\n    label: \"Full Name\",\n    required: true,\n    description: \"As it appears on your ID\",\n    showWhen: ShowWhen.WhenTouched  \u002F\u002F or Always, WhenDirty, AfterFirstSubmit, Never\n);\n```\n\n`ShowWhen` controls when error messages appear:\n- `WhenTouched` — after the user has interacted with the field (recommended default).\n  `FormField` marks its own field touched on blur; elsewhere call `MarkTouched`.\n- `Always` — immediately, even before user interaction\n- `WhenDirty` — only after the value has changed from its baseline. Requires\n  `SetInitialValue(field, value)`: with no baseline recorded a field is never\n  dirty, so this policy stays silent forever.\n- `AfterFirstSubmit` — only after the first submit attempt, which is\n  `MarkAllTouched()`. `ResetAll()` clears it, so the next reveal waits for a\n  fresh submit.\n\nThe verdict itself is unaffected by any of these — `IsValid()` and\n`GetMessages()` are current from the first render. `ShowWhen` only gates display.\n\n## 6. Masked input\n\n`MaskEngine` restricts and formats input as the user types:\n\n```csharp\nvar mask = UseMemo(() => new MaskEngine(MaskPreset.PhoneUS));\nvar (phone, setPhone) = UseState(\"\");\n\nreturn TextBox(phone, v => setPhone(mask.Apply(v)),\n    placeholderText: \"(555) 555-0123\");\n```\n\n### Mask presets\n\n| Preset | Format |\n|--------|--------|\n| `MaskPreset.PhoneUS` | `(___) ___-____` |\n| `MaskPreset.SSN` | `___-__-____` |\n| `MaskPreset.ZipCode` | `_____` |\n| `MaskPreset.ZipCodePlus4` | `_____-____` |\n| `MaskPreset.CreditCard` | `____ ____ ____ ____` |\n| `MaskPreset.Date` | `__\u002F__\u002F____` |\n\nCustom masks: `new MaskEngine(\"AA-####\")` where `A` = letter,\n`#` = digit, `*` = any.\n\n## 7. Input formatters\n\n`InputFormatter` applies format-as-you-type transformations:\n\n```csharp\nvar (amount, setAmount) = UseState(\"\");\n\nreturn TextBox(amount,\n    v => setAmount(InputFormatter.Currency(symbol: \"$\").Format(v)),\n    placeholderText: \"$0.00\");\n```\n\n| Formatter | Effect |\n|----------|--------|\n| `InputFormatter.Currency(symbol: \"$\")` | `$1,234.56` |\n| `InputFormatter.PhoneUS` | `(555) 555-0123` |\n| `InputFormatter.UpperCase` | Force uppercase |\n| `InputFormatter.LowerCase` | Force lowercase |\n| `InputFormatter.TitleCase` | Title Case |\n| `InputFormatter.MaxLength(n)` | Truncate at n chars |\n| `InputFormatter.AllowOnly(regex)` | Whitelist characters |\n\n## Critical gotchas\n\n1. **Always use controlled inputs** — `(value, setter)` pair. There is no\n   uncontrolled \u002F two-way binding in Reactor.\n2. **Call `validation.MarkAllTouched()` before submit** — when fields use the\n   `.Validate(name, value, ...)` form, validators run automatically every\n   render, but errors stay hidden until each field is touched. Mark all\n   registered fields touched on submit so error messages reveal at once,\n   then gate on `validation.IsValid()`.\n3. **Use `ShowWhen.WhenTouched`** (default) — showing errors immediately on\n   page load is hostile UX.\n4. **MaskEngine and InputFormatter are different** — masks restrict what\n   characters can be entered; formatters transform the display.\n5. **Don't mix simple validation and UseValidationContext** — pick one\n   approach per form.\n6. **FormField handles layout and error display** — don't manually build\n   error message TextBlocks when using FormField.\n",{"name":5,"description":7},"main","74791562c11792f7c0e2dd875f1e82b94d70b397","plugins\u002Freactor\u002Fskills\u002Freactor-forms",67,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-15 01:08:04",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add microsoft\u002Fmicrosoft-ui-reactor --skill reactor-forms",{"tool":52,"command":53},"bunx","bunx skills add microsoft\u002Fmicrosoft-ui-reactor --skill reactor-forms",{"tool":55,"command":56},"pnpm","pnpm dlx skills add microsoft\u002Fmicrosoft-ui-reactor --skill reactor-forms","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fplugins\u002Freactor\u002Fskills\u002Freactor-forms\u002FSKILL.md",true,[],[61,67,95,120,144,167],{"skillNo":62,"name":63,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":32},"01M69B94E15PYYWXAGFV832MRK","Charting","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fsrc\u002FReactor.Advanced\u002FCharting\u002Fskill.md",[],[63],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":32},"01M69B92C846XMSNJ4PZGVYY3C","reactor-wrapping","Turn ANY WinUI control — a vendor\u002Fthird-party control, your own custom Control, or a Windows Community Toolkit one — into a first-class declarative Reactor element with the [GenerateReactorWrapper] source generator, zero hand-written wrapper code. Covers auto-inference (props, content, two-way pairs, panel\u002Fitems children, events), the [Wrap*] annotation cheat-sheet, imperative-lifecycle controls, diagnostics, and when to fall back to a hand-written ControlDescriptor.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fplugins\u002Freactor\u002Fskills\u002Freactor-wrapping\u002FSKILL.md",[],[74,75,76,77,78,79,80,31,81,82,83,84,85,86,87,88,89,90,91,92,93,94],"reactor wrapping","declarative","with","hand","code","cheat","generator","auto","controls","custom","element","lifecycle","winui","ZeRO","panel","community","back","inference","diagnostics","toolkit","windows",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":32},"01M69B90PW92BQ4YNZYTP4SERB","reactor-windowing","Reactor top-level windowing cookbook: WindowSpec, OpenWindow, draggable windows, borderless\u002Ftool windows, placement persistence, taskbar visibility, z-order, aspect ratio, SizeToContent, displays, taskbar integration, and owner-window file\u002Ffolder pickers.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fplugins\u002Freactor\u002Fskills\u002Freactor-windowing\u002FSKILL.md",[],[102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,94,117,118,119],"reactor windowing","progress","persistence","cookbook","integration","folder","command","command palette","top","window","palette","file","restore","open","tool","remember","position","make",{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":32},"01M69B8Y5Y0VKXADXCN3W1NK89","reactor-recipes","Paste-ready single-file Reactor recipes indexed by intent — list with add\u002Fdelete\u002Ftoggle, sidebar navigation between pages, form with validation + submit gating, async fetch with loading\u002Ferror\u002Fdata states, themed Win11 card surface. Use a recipe instead of synthesizing from prose: copy, adjust, ship.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fplugins\u002Freactor\u002Fskills\u002Freactor-recipes\u002FSKILL.md",[],[127,128,113,129,76,130,25,131,132,133,134,135,136,137,138,139,140,141,142,143],"reactor recipes","recipes","recipe","form","adjust","single","pages","async","card","submit","loading","states","fetch","gating","single-file","ready","error",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":32},"01M69B8WNYS31M4P012P2QTX6R","reactor-navigation","Reactor navigation — `UseNavigation` hook, `NavigationHost` renderer, `NavigationView` sidebar, `TabView` tabs, route params, stack operations, page lifecycle, deep linking, transitions, caching. Use when building multi-page apps or wiring sidebar\u002Ftab navigation.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fplugins\u002Freactor\u002Fskills\u002Freactor-navigation\u002FSKILL.md",[],[151,152,153,31,154,25,85,155,156,157,158,159,160,161,162,163,164,165,166],"navigation","reactor navigation","caching","apps","renderer","multi-page","page","deep","wiring","hook","operations","transitions","linking","stack","route","multi",{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":32},"01M69B8TGJA43N8X6BFVWTXC1H","reactor-input","Reactor input — gestures (`OnPan`, `OnPinch`, `OnRotate`), pointer events, drag-and-drop (`OnDragStarting`), focus management (`UseElementFocus`, `UseFocus`, `UseFocusTrap`). Use when implementing direct manipulation or custom focus behavior.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-reactor\u002Fblob\u002Fmain\u002Fplugins\u002Freactor\u002Fskills\u002Freactor-input\u002FSKILL.md",[],[26,174,175,176,177,178,179,180,31,25,83,181,182,183],"reactor input","direct","events","management","behavior","focus","drop","implementing","drag","gestures"]