Skip to content

Instantly share code, notes, and snippets.

@itkrt2y
Last active Apr 19, 2022
Embed
What would you like to do?
react-hook-form + ChakraUI NumberInput
import {
NumberDecrementStepper,
NumberIncrementStepper,
NumberInput,
NumberInputField,
NumberInputStepper,
} from "@chakra-ui/react";
import { Controller } from "react-hook-form";
<Controller
name="sample"
control={control}
render={({ field: { ref, onChange, ...rest } }) => (
<NumberInput {...rest} onChange={(_, v) => onChange(v)}>
<NumberInputField ref={ref} />
<NumberInputStepper>
<NumberIncrementStepper />
<NumberDecrementStepper />
</NumberInputStepper>
</NumberInput>
)}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment