Socket
Socket
Sign inDemoInstall

@altiore/form

Package Overview
Dependencies
7
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @altiore/form

Form helper for building powerful forms


Version published
Weekly downloads
195
increased by2066.67%
Maintainers
1
Install size
1.42 MB
Created
Weekly downloads
 

Readme

Source

Altiore Form

@altiore/form

powerful forms with @altiore/form

NPM Version

русская версия README.RU.md

Why?

To simplify work with forms

Installation:

npm
npm i @altiore/form -S
yarn
yarn add @altiore/form

Simplest usage

import React, {useCallback} from 'react';

import {Form} from '@altiore/form';

const MyForm = () => {
	const handleSubmit = useCallback((values) => {
		console.log('form.values is', values);
	}, []);

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

Custom form

**Custom form allows adding fields of any type to vary your forms. Adding and deleting fields to form gives you new advantages.

import React, {useCallback} from 'react';

import {createField, Form} from '@altiore/form';

export const Field = createField(
	({
		errors,
		inputRef,
		name,
		/* you can add any extra fields here: */ label,
	}) => {
		return (
			<div>
				<label htmlFor="input-id">
					{label}
					<input id="input-id" name={name} ref="{inputRef}" />
				</label>
				<span>{errors[0]}</span>
			</div>
		);
	},
);

const MyForm = () => {
	const handleSubmit = useCallback((values) => {
		console.log('form.values is', values);
	}, []);

	return (
		<Form onSubmit={handleSubmit}>
			<Field label="Field Label" name="name" />
			<button type="submit">Submit</button>
		</Form>
	);
};

Keywords

FAQs

Last updated on 12 Nov 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc