An open API service indexing awesome lists of open source software.

https://github.com/alexferl/templaui

A Go library providing Bulma CSS components for the templ templating language
https://github.com/alexferl/templaui

bulma bulma-css bulma-css-framework go go-templ golang templ ui-components

Last synced: about 2 months ago
JSON representation

A Go library providing Bulma CSS components for the templ templating language

Awesome Lists containing this project

README

          

# TemplaUI [![Go Report Card](https://goreportcard.com/badge/github.com/alexferl/templaui)](https://goreportcard.com/report/github.com/alexferl/templaui) [![codecov](https://codecov.io/gh/alexferl/templaui/branch/master/graph/badge.svg)](https://codecov.io/gh/alexferl/templaui)

**⚠️ This is a pre-v1 release - APIs may change as we work toward a stable v1.0.**

A Go library providing [Bulma](https://bulma.io/) components for the [templ](https://templ.guide) templating language.

## Requirements
- Go 1.24+

## Installation
```shell
go get github.com/alexferl/templaui
```

## Usage
`hello.templ`:
```templ
package main

import (
"github.com/alexferl/templaui"
"github.com/alexferl/templaui/elements/tag"
"github.com/alexferl/templaui/elements/title"
"github.com/alexferl/templaui/layout/container"
)

templ Hello() {
@templaui.Document(templaui.DocumentProps{
Title: "My TemplaUI App",
Description: "A Hello World example showcasing Bulma components",
}) {
@container.Container() {
@title.Title(title.TitleProps{Size: title.Is1}) {
Hello, World!
}
@title.Subtitle(title.SubtitleProps{Size: title.Is4}) {
Built with TemplaUI & Bulma CSS
}
@tag.Tags() {
@tag.Tag(tag.TagProps{Color: tag.IsPrimary}) {
Go
}
@tag.Tag(tag.TagProps{Color: tag.IsInfo}) {
Templ
}
@tag.Tag(tag.TagProps{Color: tag.IsSuccess}) {
Bulma
}
}
}
}
}
```

`main.go`:
```go
package main

import (
"fmt"
"net/http"

"github.com/a-h/templ"
)

func main() {
http.Handle("/", templ.Handler(Hello()))
fmt.Println("Listening on :3000")
http.ListenAndServe(":3000", nil)
}
```