{"repo":"chasefleming/elem-go","free":true,"listed":false,"github":"https://github.com/chasefleming/elem-go","clone":"git clone https://github.com/chasefleming/elem-go.git","description":"Type-safe HTML for Go. Build views in pure Go: no templates, no code generation, no build step. Includes htmx helpers and type-safe CSS.","language":"Go","stars":364,"topics":["go","golang","html","htmx"],"license":"MIT","category":"workflow-automation","readme_excerpt":"Type-safe HTML for Go: no templates, no code generation, no build step. elem-go lets you build HTML views in pure Go: every element is a Go function and every attribute a typed constant, so typos fail at compile time instead of at runtime in production. And because views are plain Go code rather than a separate template language, the tools you already use work on them unchanged: autocomplete, refactoring, tests, the debugger. Features - Type-safe constructors for nearly every standard HTML5 element and attribute. - Utilities like If and TransformEach for conditional and list rendering. - Automatic HTML escaping of text content (use Raw to opt out). - Zero runtime dependencies. - Inline CSS styling with the styles subpackage. - Advanced CSS features (pseudo-classes, animations, media queries) with StyleManager . - htmx attribute helpers in the htmx subpackage. Installation To install elem-go , use go get : Usage Import the elem package in your Go code: Creating Elements Here's an example of creating a element with nested , , and elements using elem-go : Calling the .Render() method on this element produces the following HTML: Attributes and Styles The attrs subpackage provides type-safe attribute functions that ensure you're setting valid attributes for your elements. This helps eliminate potential issues at runtime due to misspelled or unsupported attribute names. For boolean attributes like checked and selected , assign the value \"true\" or \"false\" . When set to \"true\" , the ","default_branch":null,"files":null,"tree":[],"storefront":"/r/chasefleming","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/chasefleming/elem-go/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}