go-icons

module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: MIT

README

Go Icons

Go icons provides an aggregation of icon libraries for golang developers using either html/template or a-h/templ.

Simply use the command line utility to install individual icons into your project, or use them directly as templ.Component templates.

Icon Libraries

Icon Library Version License
Ionicons Ionicons version MIT
Lucide Icons Lucide Icons version ISC
Material Icons Material Icons version MIT
Radix Icons Radix Icons version MIT
Simple Icons Simple Icons version CC0 1.0

Installation & Usage

Go Icons can be used in two different ways:

  • Icons imported as a package of templ icons
  • A command line utility to generate html or templ icons directly into your project
Packages

[!NOTE] If an icon you want to use starts with a number, it will be prefixed with a capital T.

E.g,

@material.T10_24px()
Ionicons

Install

go get github.com/dimmerz92/go-icons/ionicons@latest

Usage

@ionicons.Accessibility() // no argument
@ionicons.Accessibility(templ.Attributes{}) // templ.Attributes argument
Lucide Icons

Install

go get github.com/dimmerz92/go-icons/lucide@latest

Usage

@lucide.AArrowDown() // no argument
@lucide.AArrowDown(templ.Attributes{}) // templ.Attributes argument
Material Icons

Install

go get github.com/dimmerz92/go-icons/material@latest

Usage

@material.T10_24px() // no argument
@material.T10_24px(templ.Attributes{}) // templ.Attributes argument
Radix Icons

Install

go get github.com/dimmerz92/go-icons/radix-icons@latest

Usage

@radixicons.Accessibility() // no argument
@radixicons.Accessibility(templ.Attributes{}) // templ.Attributes argument
Simple Icons

Install

go get github.com/dimmerz92/go-icons/simple-icons@latest

Usage

@simpleicons.T1001trackLists() // no argument
@simpleicons.T1001trackLists(templ.Attributes{}) // templ.Attributes argument
Command Line Utility

Install

go install github.com/dimmerz92/go-icons/cmd/go-icons@latest

Usage

[!NOTE] The command follows a simple model of go-lucide <LIBRARY>:<FORMAT> <ICON NAME> [OPTIONS]

LIBRARIES: [simple-icons radix-icons ionicons material lucide]

FORMATS: [html templ]

ICON NAMES: depending on the library, some are kebab case, snake case, or not separated.

This is an understandable painpoint, and search functionality will be on the future todos.

OPTIONS:
-out: directory to save icon to. Default: [.]

go-icons lucide:html a-arrow-down -out templates/icons

HTML Icon Usage

The HTML icons are prepared to accept optional attributes on the <svg> tags.

This can easily be done by passing them the template.HTMLAttr data structure.

iconData := []template.HTMLAttr{
    `class="some-class another-class"`,
    `style="height: 2rem; width: 2rem"`,
}
err := tpls.ExecuteTemplate(w, "a-arrow-down", iconData)
<!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>

LICENSE

This project is provided under the MIT License

All icons are provided under their respective licenses listed at the top of this document.

Directories

Path Synopsis
cmd
go-icons command
sync command
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL