Back to directory

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

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.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.