{"id":14563562,"url":"https://github.com/Desdaemon/typed-htmx","last_synced_at":"2025-09-04T06:32:17.066Z","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":136,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-09T17:57:17.137Z","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-07-27T20:16:05.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,"purl":"pkg:github/Desdaemon/typed-htmx","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","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Desdaemon%2Ftyped-htmx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273566380,"owners_count":25128594,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"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":["html","htmx","jsx","templating-engine","typesafe","typescript"],"created_at":"2024-09-07T02:03:08.197Z","updated_at":"2025-09-04T06:32:16.697Z","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":["typescript"],"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"}