🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@per-form/react

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@per-form/react

React library for form validation

0.3.1
latest
Source
npm
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

@per-form/react

@per-form/react Logo @per-form/react Logo

Fast and easy form validation for React based on native HTML capabilities

Documentation

NPM Version GitHub License npm bundle size

Features

  • ☯ Very easy to use
  • 🚀 Really fast
  • 🏋 Extra small bundle size
  • 🤯 Can works without any state
  • 💅 Native and customizable errors
  • 👯 Multiple validation modes
  • 📑 Custom validation with
    • 🎉 Cross inputs validation
    • 😎 Async validation
    • 🔥 Support dynamic form
  • 💬 Custom messages / translations
  • 💯 Fully tested
  • 📚 Support controlled components and UI libraries
  • ⚡️ Compatible with Next.js server actions
  • 👀 Watch values
  • 💪 And much more...

Install

# npm
npm install react-hook-form
# yarn
yarn add react-hook-form
# pnpm
pnpm install react-hook-form

Usage

With hook

import type { FormEvent } from 'react';
import { type IFormValues, useForm } from '@per-form/react';

export default function Demo() {
  function handleSubmit(e: FormEvent<HTMLFormElement>, values: IFormValues) {
    console.log(values);
  }

  const { formProps } = useForm({
    onSubmit: handleSubmit,
  });

  return (
    <form {...formProps}>
      <input name="text" required />
      <button type="submit">Submit</button>
    </form>
  );
}

Or with component

import type { FormEvent } from 'react';
import { Form, type IFormValues } from '@per-form/react';

export default function Demo() {
  function handleSubmit(e: FormEvent<HTMLFormElement>, values: IFormValues) {
    console.log(values);
  }

  return (
    <Form onSubmit={handleSubmit}>
      <input name="text" required />
      <button type="submit">Submit</button>
    </Form>
  );
}

Check the documentation for more.

Examples

Check the example App.

Clone this repo and then run:

npm i
npm run dev

Keywords

react

FAQs

Package last updated on 30 Apr 2024

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