# tauri-plugin-htmx

> htmx plugin for Tauri

Latest version **1.2.1** (published 2026-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install tauri-plugin-htmx
pnpm add tauri-plugin-htmx
yarn add tauri-plugin-htmx
bun add tauri-plugin-htmx
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2026-04-24 |
| First published | 2023-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 66 |
| Author | Ronie Martinez |
| Maintainers | roniemartinez |
| Keywords | htmx, tauri |

## Links

- npm: https://www.npmjs.com/package/tauri-plugin-htmx
- Repository: https://github.com/roniemartinez/tauri-plugin-htmx
- Homepage: https://github.com/roniemartinez/tauri-plugin-htmx#readme
- Issues: https://github.com/roniemartinez/tauri-plugin-htmx/issues
- npm.io page: https://npm.io/package/tauri-plugin-htmx

## Recent versions

- 1.2.1 (latest) — 2026-04-24
- 1.2.0 — 2025-02-28
- 1.0.1 — 2023-10-21
- 1.0.0 — 2023-10-13
- 0.6.0 — 2023-10-12

## README

# tauri-plugin-htmx

htmx plugin for Tauri

## How it works

`tauri-plugin-htmx` works by creating a fake ajax response by patching [`XMLHttpRequest.send()`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send).

## How to use

1. Start a Tauri project using [`create-tauri-app`](https://tauri.app/v1/guides/getting-started/setup/) and choosing "Vanilla" Javascript/Typescript as frontend.
    ```bash
   $ cargo create-tauri-app                                                  
    ✔ Project name · tauri-htmx-ts
    ✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm, bun)
    ✔ Choose your package manager · npm
    ✔ Choose your UI template · Vanilla
    ✔ Choose your UI flavor · TypeScript
   
   Template created! To get started run:
    cd tauri-htmx-ts
    npm install
    npm run tauri dev
    ```
2. Install [htmx](https://github.com/bigskysoftware/htmx)
    ```bash
    npm i htmx.org
    ```
3. Install `tauri-plugin-htmx`
    ```bash
   npm i tauri-plugin-htmx
    ```
4. Modify the form in `index.html` to use `htmx`. Instead of using a URL in `hx-post` (or `hx-get`), use the command name prefixed with `command:` (e.g. `command:greet`).
   ```diff
   -      <form class="row" id="greet-form">
   -        <input id="greet-input" placeholder="Enter a name..." />
   -        <button type="submit">Greet</button>
   -      </form>
   +      <div class="row">
   +        <input id="greet-input" name="name" placeholder="Enter a name..." />
   +        <button hx-post="command:greet" hx-include="[name='name']" hx-trigger="click" hx-target="#greet-msg" hx-swap="innerHTML">Greet</button>
   +      </div>
   ```
5. Add meta tag in `index.html`.
   ```diff
   +     <meta name="htmx-config" content='{"selfRequestsOnly":false}' />
   ```
6. Modify `main.ts` or `main.js` removing everything and replacing it with just `htmx` and `tauri-plugin-htmx` imports.
   ```typescript
   // main.ts
   import "htmx.org";
   import "tauri-plugin-htmx";
   ```

   If you are using JavaScript as frontend, you need to copy the JS files from `node_modules`.
   ```bash
   cp node_modules/htmx.org/dist/htmx.min.js src
   cp node_modules/tauri-plugin-htmx/tauri-plugin-htmx.js src
   ```
   
   Importing will be a little different.
   ```javascript
   // main.js
   import "./htmx.min.js";
   import "./tauri-plugin-htmx.js";
   ```
   
7. Run your Tauri app
   ```bash
   cargo tauri dev
   ```
   
   ![Vanilla TypeScript](screenshots/typescript.png)
   ![Vanilla JavaScript](screenshots/javascript.png)

## Author

[Ronie Martinez](mailto:ronmarti18@gmail.com)

---
_Source: https://npm.io/package/tauri-plugin-htmx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
