{"id":21930417,"url":"https://github.com/desdaemon/typed-htmx","last_synced_at":"2025-07-05T04:39:58.111Z","repository":{"id":183071532,"uuid":"669562948","full_name":"Desdaemon/typed-htmx","owner":"Desdaemon","description":"Definitions for htmx attributes","archived":false,"fork":false,"pushed_at":"2025-03-10T21:04:00.000Z","size":1070,"stargazers_count":117,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T16:13:45.818Z","etag":null,"topics":["html","htmx","jsx","templating-engine","typesafe","typescript"],"latest_commit_sha":null,"homepage":"https://desdaemon.github.io/typed-htmx/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Desdaemon.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}},"created_at":"2023-07-22T17:23:16.000Z","updated_at":"2025-03-28T14:39:13.000Z","dependencies_parsed_at":"2024-04-20T20:30:07.658Z","dependency_job_id":"413f4f48-7dfc-4844-a7b4-de57d4d9aa45","html_url":"https://github.com/Desdaemon/typed-htmx","commit_stats":{"total_commits":50,"total_committers":3,"mean_commits":"16.666666666666668","dds":"0.040000000000000036","last_synced_commit":"3605f2093323e8028a810831c72a47c33ea0ce18"},"previous_names":["desdaemon/typed-htmx"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Desdaemon%2Ftyped-htmx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Desdaemon%2Ftyped-htmx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Desdaemon%2Ftyped-htmx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Desdaemon%2Ftyped-htmx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Desdaemon","download_url":"https://codeload.github.com/Desdaemon/typed-htmx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694875,"owners_count":20980733,"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":["html","htmx","jsx","templating-engine","typesafe","typescript"],"created_at":"2024-11-28T23:09:20.410Z","updated_at":"2025-04-07T17:07:22.252Z","avatar_url":"https://github.com/Desdaemon.png","language":"TypeScript","readme":"# typed-htmx\n\n[![npm](https://img.shields.io/npm/v/typed-htmx?style=flat-square)](https://www.npmjs.com/package/typed-htmx)\n[![docs](https://github.com/Desdaemon/typed-htmx/actions/workflows/docs.yml/badge.svg)](https://github.com/Desdaemon/typed-htmx/actions/workflows/docs.yml)\n[![tests](https://github.com/Desdaemon/typed-htmx/actions/workflows/test.yml/badge.svg)](https://github.com/Desdaemon/typed-htmx/actions/workflows/test.yml)\n\n[![demo](static/demo.gif)](https://asciinema.org/a/598553)\n\nDefinitions for htmx attributes in JSX.\n\n## Usage\n\nYou can configure `typed-htmx` either as pure type declarations, or as a JSX\ntemplating engine.\n\n### As type declarations\n\nConfigure your `tsconfig.json` as follows:\n\n```jsonc\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react\",\n    \"moduleResolution\": \"node16\", // or \"nodenext\"\n    \"types\": [\"typed-htmx\" /** and any other types you need */]\n  }\n}\n```\n\nAn alternative is to include a _[triple-slash directive]_ wherever you need\ncompletions for htmx attributes:\n\n```jsx\n/// \u003creference types=\"typed-htmx\" /\u003e\n\nfunction MyComponent({ children }) {\n  return \u003cdiv hx-get=\"/asd\"\u003e{children}\u003c/div\u003e;\n  //          ^?: string | undefined\n}\n```\n\nIf your frontend library injects its own JSX types, you'll need to augment it.\nSee the [example project](https://github.com/Desdaemon/typed-htmx/tree/main/example)\nfor a demo. typed-html and React are supported out of the box.\n\n### As a JSX templating engine\n\nIf you prefer to use JSX only for its templating capabilities in the vein of\n[typed-html], you can use `typed-htmx/typed-html` which is included with this\nlibrary and optimized for htmx usage:\n\n- Attributes such as [`hx-vals`](https://htmx.org/attributes/hx-vals/) and\n  [`hx-headers`](https://htmx.org/attributes/hx-headers/) may also accept an object\n  literal, which will be stringified on demand.\n- Configurable options for sanitization, defaults to a no-op.\n\nConfigure your `tsconfig.json` as follows:\n\n```jsonc\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"jsxImportSource\": \"typed-htmx/typed-html\",\n    \"moduleResolution\": \"node16\" // or \"nodenext\"\n  }\n}\n```\n\n[typed-html]: https://github.com/nicojs/typed-html\n[triple-slash directive]: https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesdaemon%2Ftyped-htmx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdesdaemon%2Ftyped-htmx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesdaemon%2Ftyped-htmx/lists"}