{"id":13437785,"url":"https://github.com/gcanti/tcomb-form","last_synced_at":"2025-09-27T06:32:32.653Z","repository":{"id":20429375,"uuid":"23706000","full_name":"gcanti/tcomb-form","owner":"gcanti","description":"Forms library for react","archived":true,"fork":false,"pushed_at":"2020-02-18T09:31:53.000Z","size":4001,"stargazers_count":1160,"open_issues_count":48,"forks_count":136,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-05-17T10:02:46.220Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gcanti.github.io/tcomb-form","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gcanti.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-05T14:31:50.000Z","updated_at":"2024-02-15T15:45:49.000Z","dependencies_parsed_at":"2022-07-31T19:38:05.304Z","dependency_job_id":null,"html_url":"https://github.com/gcanti/tcomb-form","commit_stats":null,"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ftcomb-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ftcomb-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ftcomb-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ftcomb-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcanti","download_url":"https://codeload.github.com/gcanti/tcomb-form/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219871956,"owners_count":16554471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:00.211Z","updated_at":"2025-09-27T06:32:27.381Z","avatar_url":"https://github.com/gcanti.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized","Code Design","JavaScript"],"sub_categories":["Uncategorized","Form Logic"],"readme":"[![build status](https://img.shields.io/travis/gcanti/tcomb-form/master.svg?style=flat-square)](https://travis-ci.org/gcanti/tcomb-form)\n[![dependency status](https://img.shields.io/david/gcanti/tcomb-form.svg?style=flat-square)](https://david-dm.org/gcanti/tcomb-form)\n![npm downloads](https://img.shields.io/npm/dm/tcomb-form.svg)\n\n\u003e \"Simplicity is the ultimate sophistication\" (Leonardo da Vinci)\n\n# Notice\n\n`tcomb-form` is looking for maintainers. If you're interested in helping a great way to get started would just be to start weighing-in on GitHub issues, reviewing and testing some PRs.\n\n# Domain Driven Forms\n\nThe [tcomb library](https://github.com/gcanti/tcomb) provides a concise but expressive way to define domain models in JavaScript.\n\nThe [tcomb-validation library](https://github.com/gcanti/tcomb-validation) builds on tcomb, providing validation functions for tcomb domain models.\n\nThis library builds on those two and **realizes an old dream of mine**.\n\n# Playground\n\nThis [playground](https://gcanti.github.io/resources/tcomb-form/playground/playground.html), while a bit outdated, gives you the general idea.\n\n# Benefits\n\nWith tcomb-form you simply call `\u003cForm type={Model} /\u003e` to generate a form based on that domain model. What does this get you?\n\n1. Write a lot less HTML\n2. Usability and accessibility for free (automatic labels, inline validation, etc)\n3. No need to update forms when domain model changes\n\n# Flexibility\n\n- tcomb-forms lets you override automatic features or add additional information to forms.\n- You often don't want to use your domain model directly for a form. You can easily create a form specific model with tcomb that captures the details of a particular feature, and then define a function that uses that model to process the main domain model.\n\n# Example\n\n```js\nimport t from 'tcomb-form'\n\nconst FormSchema = t.struct({\n  name: t.String,         // a required string\n  age: t.maybe(t.Number), // an optional number\n  rememberMe: t.Boolean   // a boolean\n})\n\nconst App = React.createClass({\n\n  onSubmit(evt) {\n    evt.preventDefault()\n    const value = this.refs.form.getValue()\n    if (value) {\n      console.log(value)\n    }\n  },\n\n  render() {\n    return (\n      \u003cform onSubmit={this.onSubmit}\u003e\n        \u003ct.form.Form ref=\"form\" type={FormSchema} /\u003e\n        \u003cdiv className=\"form-group\"\u003e\n          \u003cbutton type=\"submit\" className=\"btn btn-primary\"\u003eSave\u003c/button\u003e\n        \u003c/div\u003e\n      \u003c/form\u003e\n    )\n  }\n\n})\n```\n\n**Output**. Labels are automatically generated.\n\n![](docs/example.png)\n\n# Documentation\n\n[GUIDE.md](GUIDE.md)\n\n**Browser compatibility**: same as React \u003e=0.13.0\n\n# Contributions\n\nThanks so much to [Chris Pearce](https://github.com/Chrisui) for pointing me in the right direction\nand for supporting me in the v0.4 rewrite.\n\nSpecial thanks to [William Lubelski](https://github.com/lubelski) ([@uiwill](https://twitter.com/uiwill)), without him this library would be less magic.\n\nThanks to [Esa-Matti Suuronen](https://github.com/epeli) for the excellent `humanize()` function.\n\nThanks to [Andrey Popp](https://github.com/andreypopp) for writing [react-forms](https://github.com/prometheusresearch/react-forms), great inspiration for list management.\n\n# Contributing\n\n[CONTRIBUTING.md](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Ftcomb-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcanti%2Ftcomb-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Ftcomb-form/lists"}