component
The component command lets you:
- Define reusable component templates (
tempo component define) - Generate real components from those templates (
tempo component new)
Define Component Template
bash
tempo component defineCreates a scaffold for defining a UI component, including template files and an action JSON file.
These definitions are later used by tempo component new to generate real components.
Flags
--force- Force overwriting if already exists (default: false)
--dry-run- Preview actions without making changes (default: false)
--js- Whether or not JS is needed for the component (default: false)
Generate Component Instance
bash
tempo component new --name buttonUses the templates and actions created with tempo component define to generate a real component inside assets/ and components/.
Example: Running tempo component new --name dropdown will generate:
assets/dropdown/(CSS & JS files)components/dropdown/(with .templ and .go files)
Flags
--package(-p) value- The Go package name where components will be generated (default: components)
--assets(-a) value- The directory where asset files (e.g., CSS, JS) will be generated (default: assets)
--name(-n) value- Name of the component
--js- Whether or not JS is needed for the component (default: false)
--force- Force overwriting if the component already exists (default: false)
--dry-run- Preview actions without making changes (default: false)