Rating

Capture a score like stars or points.

Preview

Please provide your rating.

Usage

<FormField
control={form.control}
name="rating"
render={({ field }) => (
<FormItem className="flex flex-col items-start">
<FormLabel>Rating</FormLabel>
<FormControl className="w-full">
<Rating
value={typeof field.value === "number" ? field.value : 0}
onChange={field.onChange}
/>
</FormControl>
<FormDescription>Please provide your rating.</FormDescription>
<FormMessage />
</FormItem>
)}
/>

Details

Copy this field block into a React Hook Form setup and swap the demo content for your own schema and labels.

form-builder/components/ui/rating.tsx