Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.

dimmerz92/go-lucide-icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

183 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Go Lucide Icons

A wrapper of Lucide Icons for Go (Golang) developers.

Requirements

  • None if using HTML templates
  • Templ if using Templ templates
go install github.com/a-h/templ/cmd/templ@latest

Installation & Usage

There 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.

The command line way

  1. Install the command line utility:
go install github.com/dimmerz92/go-lucide-icons/cmd/golucide@latest
  1. 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.

The package way

The HTML way

Add the package to your project.

go get github.com/dimmerz92/go-lucide-icons/htmlicons

All 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>

For Templ icons

Add the package to your project.

go get github.com/dimmerz92/go-lucide-icons/templicons/icons

All 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()

License

Lucide is licensed under the ISC LICENSE.

Go Lucide Icons is provided using the MIT LICENSE.

All Icons are created by Lucide Icons.

About

A wrapper of Lucide Icons for Go (Golang) Developers

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors