JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 312
  • Score
    100M100P100Q76686F
  • License EUPL-1.2

React Hook Form adapter for KoliBri - The accessible HTML-Standard.

Package Exports

  • @public-ui/react-hook-form-adapter

Readme

KoliBri - React Hook Form Adapter

This package provides simple facade components to combine React Hook Form with the KoliBri React components. Validation messages from React Hook Form are forwarded to the KoliBri inputs automatically.

Installation

npm i @public-ui/react-hook-form-adapter

Usage

import { useForm } from 'react-hook-form';
import { KolInputTextController } from '@public-ui/react-hook-form-adapter';

const MyForm = () => {
        const { control, handleSubmit } = useForm({
                defaultValues: { firstName: '' },
        });
        return (
                <form onSubmit={handleSubmit(console.log)}>
                        <KolInputTextController
                                name="firstName"
                                control={control}
                                rules={{ required: 'Please enter your name' }}
                                _label="First name"
                        />
                </form>
        );
};