New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chakra-ui-react-hook-form

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chakra-ui-react-hook-form

Bindings for using [react-hook-form](https://github.com/react-hook-form/react-hook-form) with [Chakra UI](http://next.chakra-ui.com).

  • 0.1.22
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
Maintainers
1
Weekly downloads
 
Created
Source

Chakra UI Bindings for react-hook-form

Bindings for using react-hook-form with Chakra UI.

alt Version alt License: MIT npm

Getting started

yarn add @chakra-ui/react @emotion/react @emotion/styled framer-motion react-hook-form chakra-ui-react-hook-form

Or

npm i @chakra-ui/react @emotion/react @emotion/styled framer-motion react-hook-form chakra-ui-react-hook-form

import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import {
  InputControl,
  NumberInputControl,
  TextareaControl,
  SubmitButton,
} from 'chakra-ui-react-hook-form';
import { useForm } from 'react-hook-form';

const infoFormValidationSchema = z.object({
  firstName: z.string(),
  lastName: z.string(),
  description: z.string(),
  age: z.number(),
});

type InfoFormValues = z.infer<typeof infoFormValidationSchema>;

const InfoForm = () => {
  const { control, handleSubmit } = useForm<InfoFormValues>({
    defaultValues: {
      firstName: '',
      lastName: '',
      description: '',
      age: 0,
    },
    resolver: zodResolver(infoFormValidationSchema),
  });

  const onSubmit = (values: InfoFormValues) => {
    console.log({ values });
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <InputControl control={control} name="firstName" label="First name:" />
      <InputControl control={control} name="lastName" label="Last name:" />
      <NumberInputControl control={control} name="age" label="Age:" />
      <TextareaControl control={control} name="description" label="Description:" />
      <SubmitButton control={control} />
    </form>
  );
};

Roadmap

Chakra Components

  • Input (valueAsNumber, valueAsDate, setValueAs, Left/Right Addon/Element)
  • Textarea
  • CheckboxGroup
    • Checkbox (Standalone <Checkbox />)
  • Number Input
  • Radio (<RadioGroup/>)
  • Select
  • Progress
  • Pin Input

Utility Components

  • Submit button

Extras

  • Select (using chakra-react-select)
  • File input
  • Image input (zoom & crop)

Keywords

FAQs

Package last updated on 04 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc