[go: up one dir, main page]

Skip to content

Heroicons that can be used withing the go templating language

License

Notifications You must be signed in to change notification settings

Ol1BoT/go-heroicons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Heroicons

a wrapper around heroicons that are of the template.HTML type, so they can be used in the go templating language.

this should be used in conjunction with tailwindcss.

package main

import (
	"html/template"
	"os"

	"github.com/Ol1BoT/go-heroicons"
)

type Navigation struct {
	Icon template.HTML
	Name string
	Link string
}

var (
	Nav = []Navigation{{
		Icon: heroicons.HomeSolid,
		Name: "Home",
		Link: "/",
	}, {
		Icon: heroicons.UserSolid,
		Name: "Profile",
		Link: "/profile",
	}}
)

func main() {

	tmpl, err := template.ParseFiles("example.gohtml")
	if err != nil {
		panic(err)
	}

	tmpl.Execute(os.Stdout, Nav)

}
<ul>
  {{ range $i, $v := .}}
  <li>{{$v.Icon}} - {{$v.Name}}</li>
  {{end }}
</ul>

About

Heroicons that can be used withing the go templating language

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages