diff --git a/.gitignore b/.gitignore index 7cec09962e..aecf372c10 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ tsconfig.tsbuildinfo .vscode .notes +.playwright-mcp diff --git a/apps/v4/content/docs/forms/react-hook-form.mdx b/apps/v4/content/docs/forms/react-hook-form.mdx index 76d07ab3ee..69ae4ff8f0 100644 --- a/apps/v4/content/docs/forms/react-hook-form.mdx +++ b/apps/v4/content/docs/forms/react-hook-form.mdx @@ -22,7 +22,7 @@ We are going to build the following form. It has a simple text input and a texta @@ -229,7 +229,7 @@ Display errors next to the field using ``. For styling and accessi @@ -256,7 +256,7 @@ For simple text inputs, spread the `field` object onto the input. @@ -293,7 +293,7 @@ For textarea fields, spread the `field` object onto the textarea. @@ -342,7 +342,7 @@ For textarea fields, spread the `field` object onto the textarea. @@ -397,7 +397,7 @@ For textarea fields, spread the `field` object onto the textarea. @@ -445,7 +445,7 @@ For textarea fields, spread the `field` object onto the textarea. @@ -482,7 +482,7 @@ Here is an example of a more complex form with multiple fields and validation. @@ -502,7 +502,7 @@ React Hook Form provides a `useFieldArray` hook for managing dynamic array field diff --git a/apps/v4/content/docs/forms/tanstack-form.mdx b/apps/v4/content/docs/forms/tanstack-form.mdx index acd10b3410..db855d9355 100644 --- a/apps/v4/content/docs/forms/tanstack-form.mdx +++ b/apps/v4/content/docs/forms/tanstack-form.mdx @@ -22,7 +22,7 @@ We'll start by building the following form. It has a simple text input and a tex @@ -259,7 +259,7 @@ Display errors next to the field using ``. For styling and accessi @@ -299,7 +299,7 @@ Display errors next to the field using ``. For styling and accessi @@ -341,7 +341,7 @@ Display errors next to the field using ``. For styling and accessi @@ -393,7 +393,7 @@ Display errors next to the field using ``. For styling and accessi @@ -455,7 +455,7 @@ Display errors next to the field using ``. For styling and accessi @@ -508,7 +508,7 @@ Display errors next to the field using ``. For styling and accessi @@ -547,7 +547,7 @@ Here is an example of a more complex form with multiple fields and validation. @@ -567,7 +567,7 @@ TanStack Form provides powerful array field management with `mode="array"`. This diff --git a/apps/v4/registry/new-york-v4/examples/form-rhf-checkbox.tsx b/apps/v4/registry/new-york-v4/examples/form-rhf-checkbox.tsx index bf6d88ace0..dff6d2c322 100644 --- a/apps/v4/registry/new-york-v4/examples/form-rhf-checkbox.tsx +++ b/apps/v4/registry/new-york-v4/examples/form-rhf-checkbox.tsx @@ -90,33 +90,35 @@ export default function FormRhfCheckbox() { name="responses" control={form.control} render={({ field, fieldState }) => ( -
- Responses - - Get notified for requests that take time, like research or - image generation. - - - - - - Push notifications - - - +
+
+ Responses + + Get notified for requests that take time, like research or + image generation. + + + + + + Push notifications + + + +
{fieldState.invalid && ( )} -
+ )} /> @@ -124,43 +126,47 @@ export default function FormRhfCheckbox() { name="tasks" control={form.control} render={({ field, fieldState }) => ( -
- Tasks - - Get notified when tasks you've created have updates. - - - {tasks.map((task) => ( - - { - const newValue = checked - ? [...field.value, task.id] - : field.value.filter((value) => value !== task.id) - field.onChange(newValue) - }} - /> - +
+ Tasks + + Get notified when tasks you've created have updates. + + + {tasks.map((task) => ( + - {task.label} - - - ))} - + { + const newValue = checked + ? [...field.value, task.id] + : field.value.filter( + (value) => value !== task.id + ) + field.onChange(newValue) + }} + /> + + {task.label} + + + ))} + +
{fieldState.invalid && ( )} -
+ )} /> diff --git a/apps/v4/registry/new-york-v4/examples/form-tanstack-checkbox.tsx b/apps/v4/registry/new-york-v4/examples/form-tanstack-checkbox.tsx index 58ee80e7e1..d67d28f110 100644 --- a/apps/v4/registry/new-york-v4/examples/form-tanstack-checkbox.tsx +++ b/apps/v4/registry/new-york-v4/examples/form-tanstack-checkbox.tsx @@ -98,35 +98,40 @@ export default function FormTanstackCheckbox() { const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid return ( -
- Responses - - Get notified for requests that take time, like research or - image generation. - - - - - field.handleChange(checked === true) - } - disabled - /> - +
+ Responses + + Get notified for requests that take time, like research + or image generation. + + + - Push notifications - - - + + field.handleChange(checked === true) + } + disabled + /> + + Push notifications + + + +
{isInvalid && ( )} -
+ ) }} /> @@ -138,47 +143,52 @@ export default function FormTanstackCheckbox() { const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid return ( -
- Tasks - - Get notified when tasks you've created have updates. - - - {tasks.map((task) => ( - - { - if (checked) { - field.pushValue(task.id) - } else { - const index = field.state.value.indexOf(task.id) - if (index > -1) { - field.removeValue(index) - } - } - }} - /> - +
+ Tasks + + Get notified when tasks you've created have + updates. + + + {tasks.map((task) => ( + - {task.label} - - - ))} - + { + if (checked) { + field.pushValue(task.id) + } else { + const index = field.state.value.indexOf( + task.id + ) + if (index > -1) { + field.removeValue(index) + } + } + }} + /> + + {task.label} + + + ))} + +
{isInvalid && ( )} -
+ ) }} />