From a3c904dcc971a0b6ad213765a8cb8d3faef90318 Mon Sep 17 00:00:00 2001 From: moshyfawn Date: Sat, 20 May 2023 00:58:44 -0400 Subject: [PATCH] fix(www): refactor controlled inputs API examples (#385) * refactor: remove usage of uncontrolled input apis within controlled inputs Closes: #384 * docs: display FormField controlled input usage example --------- Co-authored-by: shadcn --- apps/www/app/examples/forms/account/account-form.tsx | 4 ++-- .../www/app/examples/forms/appearance/appearance-form.tsx | 4 ++-- apps/www/app/examples/forms/profile-form.tsx | 8 ++++---- apps/www/components/examples/input/react-hook-form.tsx | 4 ++-- apps/www/components/examples/textarea/react-hook-form.tsx | 4 ++-- apps/www/content/docs/forms/react-hook-form.mdx | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/www/app/examples/forms/account/account-form.tsx b/apps/www/app/examples/forms/account/account-form.tsx index 2596e965e9..7b8465db2b 100644 --- a/apps/www/app/examples/forms/account/account-form.tsx +++ b/apps/www/app/examples/forms/account/account-form.tsx @@ -93,11 +93,11 @@ export function AccountForm() { ( + render={({ field }) => ( Name - + This is the name that will be displayed on your profile and in diff --git a/apps/www/app/examples/forms/appearance/appearance-form.tsx b/apps/www/app/examples/forms/appearance/appearance-form.tsx index 21229028f8..99ca947ab7 100644 --- a/apps/www/app/examples/forms/appearance/appearance-form.tsx +++ b/apps/www/app/examples/forms/appearance/appearance-form.tsx @@ -59,7 +59,7 @@ export function AppearanceForm() { ( + render={({ field }) => ( Font
@@ -69,7 +69,7 @@ export function AppearanceForm() { buttonVariants({ variant: "outline" }), "w-[200px] appearance-none bg-transparent font-normal" )} - {...form.register("font")} + {...field} > diff --git a/apps/www/app/examples/forms/profile-form.tsx b/apps/www/app/examples/forms/profile-form.tsx index ec94aa5251..1522f50c19 100644 --- a/apps/www/app/examples/forms/profile-form.tsx +++ b/apps/www/app/examples/forms/profile-form.tsx @@ -91,11 +91,11 @@ export function ProfileForm() { ( + render={({ field }) => ( Username - + This is your public display name. It can be your real name or a @@ -134,14 +134,14 @@ export function ProfileForm() { ( + render={({ field }) => ( Bio