Not a-h/templ. This repository is a separate component library for Go UI: copy-paste
.templbricks, helpers, and specs. It is built on top of Adrian Hacker's excellent templ project and uses the official code generatorgithub.com/a-h/templ/cmd/templ(viago tool templingo.mod). We are grateful for that foundation — templ's design and tooling make a typed, server-rendered component workflow practical.The module path is
github.com/fastygo/templso imports read naturally in application code — for exampleimport "github.com/fastygo/templ/ui"andimport cmp "github.com/fastygo/templ/components". That name reflects where these components live, not a claim to be the templ language or compiler. When you need templ itself, depend ongithub.com/a-h/templ; when you need this registry, depend ongithub.com/fastygo/templ.
shadcn-style copy-paste Templ bricks for building Go interfaces with a familiar component workflow. The registry keeps the ergonomics React developers expect — props, variants, children, composition, and small colocated examples — while staying server-rendered, Go-native, and easy to copy into an app. The goal is not to recreate React in Go, but to bring its useful component discipline to Templ: predictable APIs, composable primitives, and application-owned styling.
| Path | Role |
|---|---|
utils/ |
Only shared Go helpers — CVA (Compose), Cn, attrs, ARIA, tags.go, form recipes |
ui/ |
Primitives: button, badge, input, form controls, layout, media, links, dialog, disclosure |
components/ |
Composites: card, alert, breadcrumb, sheet, nav, icon badge |
components.json |
Registry manifest (shadcn-style) |
examples/ |
Optional local preview (server, Tailwind, dialog-only @ui8kit/aria for Sheet demos) |
.validate/docs/component.spec.template.md |
Spec template: api + showcase per brick |
.validate/docs/README.md |
Local validate-spec command and registry checks |
.cursor/rules/templ-component-spec.mdc |
Authoring rule for specs and STE comments |
.cursor/rules/ |
Agent rules — registry structure, ui8px, ARIA, examples, validation |
.ui8px/policy/ |
Tailwind class policy (ui/, components/, utils/, examples/) |
.project/go-module-publishing.md |
go get vs npm, export-ignore, release |
.project/dual-stack-component-library.md |
Dual-stack brick contract |
.project/ui8kit-aria-boundary.md |
@ui8kit/aria vs registry — APG subset |
.project/behavior-hooks-and-aria.md |
Opt-in behavior hooks, static ARIA |
utils/utils.spec.md |
Helper module export catalog (classes, attrs, recipes) |
Default bricks avoid app-specific runtime dependencies. Behavior hooks such as data-ui8kit are opt-in per component, so each consuming app can choose its own client layer.
- Copy
utils/once (importgithub.com/fastygo/templ/utils, packageuiutils). - Copy folders from
ui/button/,ui/input/,components/card/, etc. - Update the
uiutilsimport path in each.templfile to match your module. - Run
templ generateand includeui/**/*.templin your Tailwind@source. - Define your own shadcn-compatible CSS variables (
--background,--primary, …) in the consuming app — the library does not ship tokens.
See examples/README.md for a minimal preview server and Tailwind setup.
Facade (recommended):
import "github.com/fastygo/templ/ui"
import cmp "github.com/fastygo/templ/components"
@ui.Button(ui.ButtonProps{Variant: "outline", Size: "sm"}) {
Save
}
@cmp.Card(cmp.CardProps{Variant: "default"}) {
…
}Granular (optional):
import "your/module/ui/button"
@button.Button(button.ButtonProps{Variant: "outline", Size: "sm"}) {
Save
}- Variants:
ButtonVariants+ButtonClasses(props)— same mental model asbuttonVariants()in React. - className:
Classfield (additive; do not override size/variant utilities). - children:
{ children... }in the component body. - attrs:
Attrs templ.AttributesplusID,AriaLabel,Href, etc.
From the repository root:
go tool templ generate ./...Or per package, e.g. go tool templ generate ./ui/button.
Before CI, run the full registry check:
bun install
bun run verifyOr step by step:
bash .validate/scripts/validate-spec.sh --with-tests
bun run lint:ui8px
bun run validate:aria
go test ./...lint:ui8px covers ui/, components/, utils/, and examples/ against .ui8px/policy/.
See .validate/docs/README.md for spec checks and components.json alias expectations.
MIT — see LICENSE. Copyright (c) FastyGo.
This registry depends on a-h/templ; use and attribution for that project follow its own license and documentation.