Warning
This repo has been retired in favour of the newer go-icons repo.
go-icons contains all the same icons from Lucide plus thousands more from libraries such as Radix Icons, Material Icons, Simple Icons, and Ionicons.
A wrapper of Lucide Icons for Go (Golang) developers.
- None if using HTML templates
- Templ if using Templ templates
go install github.com/a-h/templ/cmd/templ@latestThere are two ways that go-lucide-icons can be used.
- As a CLI tool to generate icon templates in html/template or templ format
- A library imported in to your project for templ templates or html templates
Browse Lucide Icons for a comprehensive view of all the icons available.
- Install the command line utility:
go install github.com/dimmerz92/go-lucide-icons/cmd/golucide@latest- Generate icons to your project directly: For HTML icons
golucide html <icon name in kebab case> [-out output-directory]For Templ icons
golucide templ <icon name in kebab case> [-out output-directory]In both cases, the -out flag in step 2 is optional. By default, icons will be generated to the current working directory.
Add the package to your project.
go get github.com/dimmerz92/go-lucide-icons/htmliconsAll componenents have the same name as the lucide icons and remain in kebab case.
Simply add the lucide icon templates to your existing templates and you're ready.
tpls := template.Must(template.ParseFiles("your existing files"))
err := icons.AddLucideIcons(tpls)If you are using the icon as is, there is no need to pass any data to it. However, if you wish to add any attributes to the icon, it expects data in the form of []template.HTMLAttr.
iconData := []template.HTMLAttr{
`class="some-class another-class"`,
`style="height: 2rem; width: 2rem"`,
}
err := tpls.ExecuteTemplate(w, "a-arrow-down", iconData)To use the icons within your own templates, simply add them as named templates.
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
<p>some text</p>
<!-- expecting data -->
{{ template "worm" . }}
<!-- not expecting data -->
{{ template "fish" }}
</body>
</html>Add the package to your project.
go get github.com/dimmerz92/go-lucide-icons/templicons/iconsAll components have the same name as the lucide icons, except in pascal case.
E.g. a-arrow-down becomes AArrowDown.
To pass attributes to the icon, simply use the templ.Attributes type.
// expecting data
@icons.AArrowDown(templ.Attributes{"class": "foo"})
// not expecting data
@icons.AArrowDown()Lucide is licensed under the ISC LICENSE.
Go Lucide Icons is provided using the MIT LICENSE.
All Icons are created by Lucide Icons.