elem-go
elem-go is a Go library for building HTML views as plain Go functions instead of a separate template language, so every element and attribute is type-checked at compile time and ordinary Go tooling works on views unchanged.
elem-go builds HTML views out of ordinary Go function calls rather than a separate template language: every HTML element is a Go function and every attribute a typed constant, so a typo fails at compile time instead of showing up as broken markup in production. Because views are plain Go code, existing tooling such as autocomplete, refactoring, tests and the debugger works on them without modification.
Features include type-safe constructors for nearly all standard HTML5 elements and attributes, If and TransformEach helpers for conditional and list rendering, automatic HTML escaping with a Raw function to opt out where needed, and a styles subpackage for inline CSS that also supports pseudo-classes, animations and media queries through a StyleManager. An htmx subpackage adds typed attribute helpers for htmx. The library has zero runtime dependencies and installs with go get.