> For the complete documentation index, see [llms.txt](https://joselion.gitbook.io/lynx.ts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://joselion.gitbook.io/lynx.ts/readme.md).

# Overview

[![CI](https://github.com/JoseLion/lynxts/actions/workflows/ci.yml/badge.svg)](https://github.com/JoseLion/lynxts/actions/workflows/ci.yml) [![CodeQL](https://github.com/JoseLion/lynxts/actions/workflows/codeql.yml/badge.svg)](https://github.com/JoseLion/lynxts/actions/workflows/codeql.yml) [![Release](https://github.com/JoseLion/lynxts/actions/workflows/release.yml/badge.svg)](https://github.com/JoseLion/lynxts/actions/workflows/release.yml) [![NPM Core version](https://img.shields.io/npm/v/@lynxts/core?logo=npm\&label=core)](https://www.npmjs.com/package/@lynxts/core) [![NPM Native version](https://img.shields.io/npm/v/@lynxts/native?logo=npm\&label=native)](https://www.npmjs.com/package/@lynxts/native) [![NPM Web version](https://img.shields.io/npm/v/@lynxts/web?logo=npm\&label=web)](https://www.npmjs.com/package/@lynxts/web) [![GitHub Release Date](https://img.shields.io/github/release-date/JoseLion/lynxts)](https://github.com/JoseLion/lynxts/releases) [![Known Vulnerabilities](https://snyk.io/test/github/JoseLion/lynxts/badge.svg)](https://snyk.io/test/github/JoseLion/lynxts)

![Lynx.ts Logo](https://github.com/JoseLion/lynxts/blob/main/docs/assets/lynxts-logo%40512x512.png?raw=true)

## Lynx.ts

TypeScript-first, lightning fast Forms for React.js and React Native.

### How it works

Lynx.ts is a [React Context](https://react.dev/learn/passing-data-deeply-with-context) based Form Provider. However, thanks to the brilliant [use-context-selector](https://github.com/dai-shi/use-context-selector) the re-renders caused by changes in the context are drastically reduced. The `use-context-selector` hook implements [React's RFC context selector](https://github.com/reactjs/rfcs/pull/119) in user land, this way we can specifically select what we need from the context and avoid unnecessary re-renders when unused parts of the context change.

Being a TypeScript-first library, you'll find type-safety on every turn: validation, simple/array/nested fields, form submision, etc. The codebase also follows a [full memoization principle](https://attardi.org/why-we-memo-all-the-things/), which makes Lynx.ts fast and performant on small or big projects.

### Compatibility

Lynx.ts is based on context and hooks, so you'll need a minimun version of `v16.8.0` on React.js. TypeScript is not necessary to use it, it works on plain JavaScript too! However, TS will give you a better dev experience and static check safety, so it's recommended.

### Usage

Lynx.ts is split three packages for convinience:

* [**@lynxts/core**](/lynx.ts/packages/core.md)**:** Main functionalities, can be used in any kind of React.js environment.
* [**@lynxts/native**](/lynx.ts/packages/native.md)**:** React Native specific abstractions and helpers.
* [**@lynxts/web**](/lynx.ts/packages/web.md)**:** DOM specific abstractions and helpers.

Check each package documentation for more details on how to use them.

### Design and next steps

Validation is a crutial part of forms in most cases. For Lynx.ts validation is always required, but because it can be a whole project out on its own, validation is supported through 3rd-party libraries. Both [Yup](https://github.com/jquense/yup) and [Zod](https://zod.dev/) schemas are supported out-of-the-box, but you can use any other library by just implementing an `Adapter<T>` which tells the form how to validate the schema. Check the Core package documentation for more details on [custom validation adapters](/lynx.ts/packages/core.md#validation-adapters). In the remote case you don't need to validate your forms, we provide a `noValidate()` adapter which you can use as well.

Errors are present only if the **field was touched or the form submitted**. Adding other behaviors to how errors show will be based on requests and their use cases. Feel free to open an issue and share yours!

### Something's missing?

Suggestions are always welcome! Please create an [issue](https://github.com/JoseLion/lynxts/issues/new) describing the request, feature, or bug. We'll try to look into it as soon as possible 🙂

### Contributions

Contributions are very welcome! To do so, please fork this repository and open a Pull Request to the `main` branch.

### License

[MIT License](https://github.com/JoseLion/lynxts/blob/main/LICENSE/README.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://joselion.gitbook.io/lynx.ts/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
