Skip to content

Commit

Permalink
docs: ✏️ Add defaultValues to input in form examples (#1610)
Browse files Browse the repository at this point in the history
Fixes: #1609
  • Loading branch information
nathanbrachotte authored Oct 21, 2023
1 parent 6b66003 commit 958a0fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/www/registry/default/example/input-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const FormSchema = z.object({
export default function InputForm() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
username: "",
},

This comment has been minimized.

Copy link
@Jared-Dahlke

Jared-Dahlke Nov 2, 2023

@nathanbrachotte i'm getting a hydration error when i use this component in a new next app. Are you able to reproduce? Even if i add 'use client'

This comment has been minimized.

Copy link
@Jared-Dahlke

Jared-Dahlke Nov 2, 2023

@nathanbrachotte nevermind i think it's my lastpass extension

})

function onSubmit(data: z.infer<typeof FormSchema>) {
Expand Down
3 changes: 3 additions & 0 deletions apps/www/registry/new-york/example/input-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const FormSchema = z.object({
export default function InputForm() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
username: "",
},
})

function onSubmit(data: z.infer<typeof FormSchema>) {
Expand Down

1 comment on commit 958a0fd

@vercel
Copy link

@vercel vercel bot commented on 958a0fd Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./apps/www

ui-shadcn-pro.vercel.app
example-playground.vercel.app
ui.shadcn.com
ui-git-main-shadcn-pro.vercel.app

Please sign in to comment.