{"id":50143081,"url":"https://github.com/uinaf/react-json-logic","last_synced_at":"2026-05-24T02:36:54.734Z","repository":{"id":57097085,"uuid":"77840024","full_name":"uinaf/react-json-logic","owner":"uinaf","description":"Build and evaluate JsonLogic with React components","archived":false,"fork":false,"pushed_at":"2026-05-18T01:46:19.000Z","size":584,"stargazers_count":27,"open_issues_count":2,"forks_count":23,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-18T09:55:58.834Z","etag":null,"topics":["builder","component","json","logic","react","ui"],"latest_commit_sha":null,"homepage":"https://uinaf.dev/projects/react-json-logic","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/uinaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2017-01-02T14:43:38.000Z","updated_at":"2026-05-16T13:42:43.000Z","dependencies_parsed_at":"2022-08-20T18:10:19.866Z","dependency_job_id":null,"html_url":"https://github.com/uinaf/react-json-logic","commit_stats":null,"previous_names":["altayaydemir/react-json-logic","uinaf/react-json-logic","altaywtf/react-json-logic"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/uinaf/react-json-logic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uinaf%2Freact-json-logic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uinaf%2Freact-json-logic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uinaf%2Freact-json-logic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uinaf%2Freact-json-logic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uinaf","download_url":"https://codeload.github.com/uinaf/react-json-logic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uinaf%2Freact-json-logic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33419556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"online","status_checked_at":"2026-05-24T02:00:06.296Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["builder","component","json","logic","react","ui"],"created_at":"2026-05-24T02:36:53.617Z","updated_at":"2026-05-24T02:36:54.718Z","avatar_url":"https://github.com/uinaf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-json-logic\n\nBuild and evaluate [JsonLogic](http://jsonlogic.com) rules with React components.\n\n`react-json-logic` is headless. No CSS is shipped. You style it however you want.\n\n## Installation\n\n```bash\npnpm add react-json-logic react react-dom\n```\n\n## Basic Usage\n\n```tsx\nimport { useState } from \"react\";\nimport JsonLogicBuilder, { applyLogic, type JsonLogicValue } from \"react-json-logic\";\n\nfunction Example() {\n  const [rule, setRule] = useState\u003cJsonLogicValue\u003e(\"\");\n  const data = { user: { age: 21 } };\n\n  return (\n    \u003c\u003e\n      \u003cJsonLogicBuilder value={rule} data={data} onChange={setRule} /\u003e\n      \u003cp\u003eResult: {String(applyLogic(rule, data))}\u003c/p\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n## API Overview\n\n- Default export: `JsonLogicBuilder`\n- Named exports: `applyLogic`, `rule`, `validate`, `OPERATORS`, `FIELD_TYPES`\n- Core types: `JsonLogicValue`, `JsonLogicData`, `ValidationResult`, `ValidationError`\n\n### Component Props\n\n- `value: JsonLogicValue` - controlled current rule\n- `onChange: (value: JsonLogicValue) =\u003e void` - called whenever the rule changes\n- `data?: JsonLogicData | string` - sample data for accessor suggestions (`var`)\n- `onDataError?: (err: unknown, raw: string) =\u003e void` - parse error hook when `data` is a string\n\n## Styling\n\nUse stable `data-rjl-*` attributes to style the rendered DOM (for example with Tailwind, CSS Modules, or vanilla CSS).\n\nCommon hooks include:\n\n- `data-rjl-builder`\n- `data-rjl-any`\n- `data-rjl-field`\n- `data-rjl-add`\n- `data-rjl-remove`\n- `data-rjl-operator-trigger`\n- `data-rjl-operator-popup`\n- `data-rjl-input-value`\n- `data-rjl-accessor-input`\n- `data-rjl-higher-order`\n\n## Building Rules in Code\n\nUse the typed `rule` factory to construct rules without hand-writing JSON:\n\n```ts\nimport { applyLogic, rule, validate } from \"react-json-logic\";\n\nconst r = rule.and(rule.eq(rule.var(\"user.age\"), 21), rule.gt(rule.var(\"score\"), 100));\n\napplyLogic(r, { user: { age: 21 }, score: 150 }); // true\nvalidate(r); // { ok: true }\n```\n\n## Repo and Development\n\nThis repository is a workspace with:\n\n- `packages/react-json-logic` (publishable npm package)\n- `apps/example` (demo app)\n\nFrom the workspace root:\n\n```bash\nvp install\npnpm verify\npnpm dev:example\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Security\n\nSee [SECURITY.md](SECURITY.md).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuinaf%2Freact-json-logic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuinaf%2Freact-json-logic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuinaf%2Freact-json-logic/lists"}