Loading...
Loading...
Learn and write templ component syntax including expressions, conditionals, loops, and Go integration. Use when writing .templ files, learning templ syntax, or mentions 'templ component', 'templ expressions', or '.templ file syntax'.
npx skill4agent add xe/site templ-syntax.templ{ expr }@OtherComponent(...)ifforswitchpackage components
templ Greeting(name string, isAdmin bool) {
<h1>Hello, { name }</h1>
if isAdmin {
<p>Admin mode</p>
}
}{ value }class={ classes }disabled?={ isDisabled }{ children... }@Component(...)templ.URL(...)templ Card(title string) {
<section class="card">
<h2>{ title }</h2>
<div>{ children... }</div>
</section>
}
templ UserList(users []string) {
if len(users) == 0 {
<p>No users</p>
} else {
<ul>
for _, user := range users {
<li>{ user }</li>
}
</ul>
}
}templ-componentstempl-httptempl-htmxresources/foundations.mdresources/patterns.mdresources/reference.md