Skip to content

Instantly share code, notes, and snippets.

Working from home

Dmitry Sqvall

Working from home
  • Russia/Krasnodar
View GitHub Profile
Sqvall / file-upload.tsx
Last active Dec 1, 2021
File Upload with Chakra UI and react-hook-form
View file-upload.tsx
import { ReactNode, useRef } from 'react'
import { Button, FormControl, FormErrorMessage, FormLabel, Icon, InputGroup } from '@chakra-ui/react'
import { useForm, UseFormRegisterReturn } from 'react-hook-form'
import { FiFile } from 'react-icons/fi'
type FileUploadProps = {
register: UseFormRegisterReturn
accept?: string
multiple?: boolean
children?: ReactNode