Potion/examples/hello.templ
Hayden Hargreaves e8d4d8d8ab (DOCS): Created the Project Structure guide.
This serves as outsider notes as well as my own reference sheet.
2025-06-13 14:59:39 -07:00

46 lines
651 B
Plaintext

package main
script log(s string) {
console.log(s)
}
templ hello(name string) {
<div>Hello, { name }</div>
}
templ headerTemplate(name string) {
<header data-testid="headerTemplate">
<h1>{ name } </h1>
</header>
}
templ button(text string) {
<button onClick={log("clicked")} class="button">
{ text }
</button>
}
templ component(testID string) {
<p data-testid={ testID }>text </p>
@headerTemplate("Hayden")
}
templ page2() {
<p
if 5==5 {
class="also five"
}
>
if 5 == 5 {
"five is five"
}
</p>
@component("testid-123")
}
templ spread(attrs templ.Attributes) {
<p class="bg-red-500" { attrs... }>
Text
</p>
}