ts-nano-form

A simple and versatile way to make forms. Lightweight and dependency free.
1,294 2
Install
npm install ts-nano-form
Latest Version:0.2.13
License:MIT
Last Updated:Sep 19, 2025
Links: GitHub  ·  npm
Maintainer: kenjiccp

tsnanoform


A simple and versatile way of working with forms. Lightweight and dependency free.


Made with ❤️ by lehnihon & contributors


npm version install size npm bundle size npm downloads npm


Documentation

Visit https://lehnihon.github.io/ts-nano-form-docs/ to view the documentation.

Getting Started

Install

npm install ts-nano-form

Quickstart

First initialize the main NanoForm object.

import NanoForm from "ts-nano-form";

const TsNanoForm = NanoForm();

For each form, create a component with the createForm method. Validation is done by the resolver.

import NanoForm from "ts-nano-form";

type FormUserType = {
  name: string;
};

const resolver = (data: any) => {
  const errors = {
    name: "",
  };
  if (!data.name) errors.name = "name required";

  return errors;
};

const TsNanoForm = NanoForm();
const { createForm } = TsNanoForm;
createForm<FormUserType>({
  name: "form-user",
  resolver,
});
export default TsNanoForm;

The fields are filled in and returned by the setValue and getValue methods

import TsNanoForm from "./nanoForm";

const { field } = TsNanoForm.getForm("form-user");
const { getValue, setValue } = field("name");

setValue("user name");
getValue();
//user name

The submit method validate all fields by the resolver and the fields are returned via the data parameter.

import TsNanoForm from "./nanoForm";

const { submit } = TsNanoForm.getForm("form-user");

submit((data) => console.log("submit", data));

License

MIT

Related Packages

awesome-snackbar

React, Angular, Vue, and Typescript compatible snackbar.

9,667 6
formalistic

Handle form data and form validation

786 18
@xcodleox/devinspector

SDK de monitoramento e auditoria de erros em tempo real | Dev Inspector

7,360
toastify-all

Universal, modern toast notification engine for all JavaScript frameworks and pl...

353 1
@decaf-ts/ui-decorators

Extension of decorator validation to ui elements to allow for web integration

36,621 0

Version History

Version Released License
0.2.13 MIT
0.2.12 MIT
0.2.11 MIT
0.2.10 MIT
0.2.9 MIT