Build server-rendered web UIs in Go where the compiler catches typos in HTML component code.
Use HTMX with Go to add interactive page updates without writing any JavaScript.
Get autocomplete and error highlighting for HTML templates inside VS Code or Neovim.
Generate consistent, type-safe HTML from reusable Go components across a large codebase.
Requires the templ CLI in addition to Go, full editor support needs LSP configuration per editor.
Templ is a templating language for Go that lets developers write HTML component definitions directly in Go files, with full type safety and editor support. Instead of writing HTML in separate string-based template files where typos only show up at runtime, templ lets you define HTML components in a syntax that the compiler can check, catching errors before the code runs. The project ships a command-line tool that compiles .templ files into standard Go code. This generated Go code is what actually runs on your server, meaning the templates have no runtime dependency on a template engine at the point of serving requests. The CLI also includes a formatter to keep templ files consistently styled. Developer tooling is a focus of the project. Templ provides a Language Server Protocol (LSP) implementation, which means editors like VS Code, Neovim, or any other LSP-compatible editor can offer autocomplete, error highlighting, and go-to-definition inside .templ files the same way they do for regular Go code. The project README includes a GIF showing this IDE integration in action. Templ is commonly used with HTMX, a library that adds interactivity to HTML by making server-round-trips on user actions. The combination is a pattern for building web UIs with Go on the server without writing JavaScript. Documentation and guides live at the templ.guide website. The README for this repository is primarily a list of developer build tasks for contributors working on templ itself (building, testing, formatting, releasing), rather than a user introduction. Full user documentation is at the external docs site.
← a-h on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.