Important
100% AI-Generated Codebase: This repository and all of its contents—including the spec-parsing pipelines, code generators, Go AST component builders, interactive Cobra CLI, live preview server, test suites, and documentation—have been generated in their totality by AI.
A Go component library for DaisyUI, generated from daisyUI's own
skills/daisyui/components/*.md specs (github.com/saadeghi/daisyui),
built on the ht HTML-AST-builder pattern (github.com/AccentDesign/ht).
- 67/68 components covered (all but
calendar, which documents 3 unrelated JS library integrations rather than a class-based component). - 430 generated test cases assert EXACT class-attribute output for every documented color/size/style/modifier/part class, sourced directly from the spec markdown -- no hand-typed expectations.
Run the automated script to fetch latest specs from github.com/saadeghi/daisyui, regenerate Go files, and run the test suite:
./fetch_specs.sh-
Clone the DaisyUI component markdown specs using Git sparse checkout:
git clone --depth 1 --filter=blob:none --sparse https://github.com/saadeghi/daisyui.git ./tmp_daisyui (cd ./tmp_daisyui && git sparse-checkout set skills/daisyui/components) mkdir -p ./specs/components cp ./tmp_daisyui/skills/daisyui/components/*.md ./specs/components/ rm -rf ./tmp_daisyui
-
Run the 3-stage generation pipeline:
# 1. Parse markdown specs into specs.json python3 parse_specs.py ./specs/components # 2. Generate Go builders, class constants, and runtime registry python3 gen_go.py # 3. Generate 430+ automated class verification tests python3 gen_test.py
-
Verify end-to-end with Go tests:
go vet ./... go test ./... -v
go build ./...
go vet ./...
go test ./...
daisyui-go provides a full-featured Cobra CLI (cmd/daisyui) for generating code, previewing components live in the browser, and inspecting component metadata:
# Install the CLI
go install ./cmd/daisyui
# Or run directly
go run ./cmd/daisyui [command]Launch the interactive terminal wizard with live search and arrow-key navigation, or pass a component slug directly:
# Interactive terminal wizard (auto-copies Go snippet to clipboard)
go run ./cmd/daisyui gen
# Direct component selection
go run ./cmd/daisyui gen table
go run ./cmd/daisyui gen card -o card.go
# Start live preview server with a specific theme (e.g. cyberpunk, cupcake, dark)
go run ./cmd/daisyui gen table -s -p 3000 -t cyberpunk- Arrow-Key Navigation & Live Filtering: Type characters to filter the 67 components live; navigate options with
↑/↓andSpacecheckboxes. - Automatic Clipboard Copy: Generated Go snippets are instantly copied to your clipboard.
- Live Theme Switching: The
--servepreview server includes an in-browser theme dropdown covering all 35 DaisyUI themes.
View all 67 supported components, root HTML tags, base classes, and modifier counts:
go run ./cmd/daisyui listView full modifier categories, constants, and sub-part structures for any component:
go run ./cmd/daisyui info card
go run ./cmd/daisyui info modalStart a standalone live preview server:
go run ./cmd/daisyui serve -p 3000 -t synthwaveGenerate tab-completion for bash, zsh, fish, or powershell:
# For Zsh
source <(daisyui completion zsh)
# For Bash
source <(daisyui completion bash)go run ./examples/demo
go run ./examples/interactive