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

@formeum/core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formeum/core

[![npm version](https://badge.fury.io/js/@formeum%2Fcore.svg)](https://badge.fury.io/js/@formeum%2Fcore) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![codecov](https://codecov.io/gh/s

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm version License: GPL v3 codecov code style: prettier Codacy Badge Node.js CI Netlify Status Netlify Status

Storybook TypeDoc TypeScript RollupJS React

@formeum/core

The core Formeum core package. This package handles the context, error state, touched state and validation. All other packages are optional.

Installation

npm i --save @formeum/core

Usage

Each form must be generated using the createForm function. This generates the typed context, hooks and components.

// myForm.ts

import { createForm } from '@formeum/core';

interface MyFormValues {
    myField: string;
    // more fields here
}

export const myForm = createForm<MyFormValues>();

The return value now contains all the typed form hooks and components. These can be used to render and handle the form:

import { myForm } from './myForm.ts';

export const MyComponent = () => (
    <myForm.FormHandler initialValues={{ myField: "" }} onSubmit={() => Promise.resolve()}>
        <label>
            First name

            <myForm.FormHTMLInput name="myField">
                {props => <input {...props} />}
            </myForm.FormHTMLInput>
        </label>

        <myForm.FormCallback>
            {({ submitForm }) => (
                <button onClick={() => submitForm()}>Submit</button>
            )}
        </myForm.FormCallback>
    </myForm.FormHandler>
);

This is a basic example, but Formeum exports many different hooks and components which use each other internally, meaning you can extract different bits of logic you need and use the library in a way which suits you. It is recommended to look at the full JSDocs to see these. You can also see and play with many examples in the storybook documentation.

FAQs

Package last updated on 28 Jul 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