{"id":15707805,"url":"https://github.com/psychollama/freeform-input","last_synced_at":"2025-07-13T19:08:45.911Z","repository":{"id":37051087,"uuid":"314473684","full_name":"PsychoLlama/freeform-input","owner":"PsychoLlama","description":"An optimized controlled input for React","archived":false,"fork":false,"pushed_at":"2025-07-09T06:02:06.000Z","size":6607,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-09T07:20:18.219Z","etag":null,"topics":["controlled","form","input","react"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/PsychoLlama.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-20T07:05:52.000Z","updated_at":"2025-07-09T06:01:16.000Z","dependencies_parsed_at":"2024-03-22T20:50:39.421Z","dependency_job_id":"77f1ef44-dc02-420f-88cb-6e613d938d4c","html_url":"https://github.com/PsychoLlama/freeform-input","commit_stats":{"total_commits":725,"total_committers":6,"mean_commits":"120.83333333333333","dds":"0.26620689655172414","last_synced_commit":"d520918c126ab09caac7c8a349fdd601d1dff09e"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/PsychoLlama/freeform-input","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsychoLlama%2Ffreeform-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsychoLlama%2Ffreeform-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsychoLlama%2Ffreeform-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsychoLlama%2Ffreeform-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PsychoLlama","download_url":"https://codeload.github.com/PsychoLlama/freeform-input/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsychoLlama%2Ffreeform-input/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265191290,"owners_count":23725291,"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":["controlled","form","input","react"],"created_at":"2024-10-03T20:41:26.057Z","updated_at":"2025-07-13T19:08:44.843Z","avatar_url":"https://github.com/PsychoLlama.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eReact Freeform Input\u003c/h1\u003e\n  \u003cp\u003eA controlled \u003ccode\u003e\u0026lt;input\u0026gt;\u003c/code\u003e posing as an uncontrolled input.\u003c/p\u003e\n\n  \u003ca href=\"https://github.com/PsychoLlama/freeform-input/actions?query=workflow%3ACI\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/workflow/status/PsychoLlama/freeform-input/CI/main\" alt=\"build status\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://www.npmjs.com/package/freeform-input\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/freeform-input\" alt=\"npm version\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://bundlephobia.com/result?p=freeform-input\"\u003e\n    \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/freeform-input\" alt=\"bundle size\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## Install\n```bash\n$ yarn add freeform-input\n```\n\n## Purpose\nReact form controls fall in two categories:\n[controlled](https://reactjs.org/docs/forms.html#controlled-components) and\n[uncontrolled](https://reactjs.org/docs/uncontrolled-components.html). The\nexact details are well documented elsewhere, but it doesn't matter, because\nthe dichotomy is a lie. You don't have to choose! There exists a perfect\nmiddleground tradeoff, the Hybrid Controllable Input pattern.\n\nAn HCI behaves like a typical controlled input until it gains focus, then it\nenters a freeform edit mode. Once the user is finished making changes,\na single change event is emitted and it snaps back to a declarative controlled\nmode.\n\nThis is particularly useful with a centralized state management library like\nRedux. You can sync your input state without needing a dispatch on every\nkeystroke, state changes won't wipe out your user's changes, and intermediate\nedits don't violate validation rules.\n\n## API\nThis library is functionally identical to `\u003cinput\u003e` save for one exception: it\noverrides `onChange`:\n\n```ts\nconst [inputState, updateState] = useState('input value')\n\n\u003cFreeformInput\n  value={inputState}\n  onChange={updateState}\n/\u003e\n```\n\nThe handler emits a value, **not an event**. This is due to a [limitation in\nReact](https://github.com/facebook/react/issues/9657) where they deviate from\nbrowser behavior. React doesn't have a real `onChange` event.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsychollama%2Ffreeform-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsychollama%2Ffreeform-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsychollama%2Ffreeform-input/lists"}