Skip to content

reactleaf/input

Repository files navigation

@reactleaf/input

Variable Input components

See on Storybook

Usage

@reactleaf/input requires react-select and react-datepicker as peer dependency.

pnpm add @reactleaf/input react-hook-form react-select react-datepicker
import { TextInput } from "@reactleaf/input"

function YourComponent() {
  const [value, setValue] = useState()
  return <TextInput value={value} onValueChange={setValue} />
}

Use with react-hook-form

Install with react-hook-form

pnpm add @reactleaf/input react-hook-form react-select
import useForm, { FormProvider } from "react-hook-form"
import { TextInput } from "@reactleaf/input/hookform"

function YourComponent() {
  const form = useForm()
  return (
    <FormProvider {...form}>
      <TextInput name="hook-form-name" />
    </FormProvider>
  )
}