Zero Runtime Overhead
Pure compile-time transformation to native Lit templates. No runtime library needed.
A powerful JSX compiler and Vite plugin that transforms JSX into native Lit templates at compile time with zero runtime overhead
Write familiar JSX that compiles to efficient Lit templates:
function TodoItem({ todo, onToggle, onDelete }) {
return (
<div classList={{ completed: todo.completed }}>
<input
type="checkbox"
checked={as.prop(todo.completed)}
disabled={as.bool(todo.readonly)}
onchange={() => onToggle(todo.id)}
/>
<span>{todo.text}</span>
<button onclick={() => onDelete(todo.id)}>Delete</button>
</div>
);
}This compiles to:
html`
<div class=${classMap({ completed: todo.completed })}>
<input
type="checkbox"
.checked=${todo.completed}
?disabled=${todo.readonly}
@change=${() => onToggle(todo.id)}
/>
<span>${todo.text}</span>
<button @click=${() => onDelete(todo.id)}>Delete</button>
</div>
`npm install @arcmantle/lit-jsxpnpm add @arcmantle/lit-jsxyarn add @arcmantle/lit-jsx// vite.config.ts
import { defineConfig } from 'vite'
import { litJsx } from '@arcmantle/lit-jsx/vite'
export default defineConfig({
plugins: [litJsx()],
}){
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "@arcmantle/lit-jsx"
}
}Now you're ready to start using JSX with Lit! 🚀