Since ui8kit 3.7 / @ui8kit/registry 3.7 the htmltemplate runtime installs the UI8Kit primitives for the Go
standard library html/template: one Go package ui with the templates embedded
(//go:embed), no templ, no code generation step, no external modules. Works with
Laravel Go views and any html/template app. Same DOM/ARIA as every other runtime.
# in the app root (next to go.mod)
npx ui8kit@latest init --yes --framework htmltemplate --dir internal/ui8kit
npx ui8kit@latest add --all--framework htmltemplateis explicit only: ago.modproject is never auto-detected ashtmltemplate(templ apps have ago.modtoo).initwritesinternal/ui8kit/utils/*.go,internal/ui8kit/ui/funcs.go, the agent rules.cursor/rules/ui8kit-primitives.mdc,ui8kit.config.jsonandui8kit.lock.json. Nopackage.json.addwritesinternal/ui8kit/ui/<brick>.goand the embeddedinternal/ui8kit/ui/<brick>/*.html.- The generated import
github.com/ui8kit/codegen/generated/htmltemplate/utilsis rewritten fromgo.modto<module>/internal/ui8kit/utilsin every installed*.go(withoutgo.modthe CLI warns and prints the fix).
Plain html/template:
import "example.com/app/internal/ui8kit/ui"
t := template.Must(template.New("page").Funcs(ui.Funcs()).ParseFS(views, "*.html"))Laravel Go (bootstrap/app.go):
import (
"context"
"html/template"
"app/internal/ui8kit/ui"
)
func Options() laravel.Options {
return laravel.Options{
// …
Views: resources.Views,
ViewFuncs: func(ctx context.Context) template.FuncMap { return ui.Funcs() },
}
}(In a Laravel package: r.ViewFuncs(func(ctx context.Context) template.FuncMap { return ui.Funcs() }) in Register.)
The kit's own templates are embedded in package ui: nothing goes to resources/views.
{{ ui8kit_render "button" (ui8kit_dict "Variant" "outline" "Href" "/docs" "Children" "Docs") }}
{{ ui8kit_render "box" (ui8kit_dict "Tag" "section" "Children" (ui8kit_render "text" (ui8kit_dict "Tag" "h2" "Children" .Title))) }}
{{ ui8kit_render "select" (ui8kit_dict "Name" "c" "Options" (ui8kit_list (ui8kit_dict "Value" "a" "Label" "A"))) }}
- Render names are snake case (
select_option), props are canonical PascalCase (Tag,Class,Attrs). - Children are markup only as
template.HTML(anotherui8kit_render, Laravel'srender "partial"); a plain string is escaped. Never convert user input totemplate.HTML. ui8kit_classes "button" (ui8kit_dict …)composes classes without rendering (no asChild);ui8kit_attrsprints an attribute map with the kit's checks (invalid names dropped, unsafe URLs omitted).- Known difference: html/template percent-encodes URL values (
/a b→/a%20b, alsotel:+7 900).
Tailwind v4 (standalone CLI is fine) must scan the Go templates: add @source "../internal/ui8kit"; (path relative
to your CSS entry) next to @import "tailwindcss";, plus your own views (@source "../resources/views";).
The default registry https://registry.buildy.tw/htmltemplate also serves the compositions and the 168 blocks of
the kit (the same items as every runtime, Go functions over ui.<Part> returning (template.HTML, error)):
npx ui8kit@latest add hero-simple faq-simple # or add --all- They land next to the primitives as packages of your module:
{dir}/compose,{dir}/blocks(+blocks/presets,blocks/recipes, embedded),{dir}/orgutils,{dir}/icons. The CLI rewrites the kit module rootgithub.com/ui8kit/codegen/generated/htmltemplate/…to<module>/<dir>/…(3.7.0 rewrote…/utilsonly). - Every block registers itself; parse your views with
blocks.Funcs()(ui.Funcs()+ui8kit_block):ViewFuncs: func(ctx context.Context) template.FuncMap { return blocks.Funcs() }. - In a view:
{{ ui8kit_block "hero-simple" (ui8kit_dict "title" "Hello" "description" .Lead) }}; props are the JSON shapes of the TypeScript props (camelCase),childrenistemplate.HTMLor escaped text. In Go:blocks.HeroSimple(blocks.HeroSimpleProps{Title: "Hello"})orblocks.Render("hero-simple", map[string]any{…}).
See also: Server runtimes · codegen docs/runtimes/htmltemplate.md.