Slider

Select a numeric value from a range.

Preview

35
0100

Adjust the price by sliding.

Usage

<FormField
control={form.control}
name="set_price_range"
render={({ field: { value, onChange } }) => (
<FormItem>
<FormLabel>Set Price Range - {typeof value === "number" ? value : 0}</FormLabel>
<FormControl>
<Slider
min={0}
max={100}
step={5}
value={[typeof value === "number" ? value : 0]}
onValueChange={(vals) => {
onChange(vals[0]);
}}
/>
</FormControl>
<FormDescription>Adjust the price by sliding.</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/slider.tsx