stylexcn

Form

React Hook Form bindings for labels, controls, descriptions, and messages. Values and errors are pinned so the preview does not drift.

Preview

This is your public display name.

Installation

pnpm dlx shadcn@latest add https://stylexcn.vercel.app/r/form.json
pnpm dlx shadcn@latest add @stylexcn/form

Usage

<Form {...form}>
  <form onSubmit={form.handleSubmit(onSubmit)}>
    <FormField
      control={form.control}
      name="username"
      render={({ field }) => (
        <FormItem>
          <FormLabel>Username</FormLabel>
          <FormControl>
            <Input placeholder="shadcn" {...field} />
          </FormControl>
          <FormDescription>
            This is your public display name.
          </FormDescription>
          <FormMessage />
        </FormItem>
      )}
    />
    <Button type="submit">Submit</Button>
  </form>
</Form>