Icons
Iridium uses lucideicons to provide icons. A dump of all icons is stored as templ components you can call throughout your application. This is tree-shaken based on your includes to keep the binary size down.
Icon list
Please refer to lucideicons to search for the icon of your choice.
Icons
Iridium's icons are stored globally to allow you to call on them directly without a method call. For example:
import "github.com/iridiumgo/iridium/view/icon/icons"
icons.Anvil // This is a global ptr to the anvil iconCustomizing Icons
Icons have a series of methods that allow you to customize them.
Size
icons.Anvil.Size("xs")
// There is also an enum for you to use:
icons.Anvil.Size(icons.SizeXS)The supported sizes are:
xxsxssmmdlgxlxxl
Stroke
Stroke applies the stroke color to the icon.
icons.Anvil.Stroke("red")StrokeWidth
StrokeWidth applies the stroke width to the icon.
icons.Anvil.StrokeWidth("2")Attributes
Attributes allows you to add custom attributes to the icon.
icons.Anvil.Attributes(map[string]any{
"@click" : "alert('You just clicked this anvil!'),
})Class
Class is a convience method to apply a class attribute to the icon.
icons.Anvil.Class("text-red-500")Component
Component returns the underlying templ component for this icon. This is useful when creating your own templ files where you want access to Iridium's icons.
templ MyComponent() {
@icons.Anvil.Component()
}Global customization
Because icons are stored globally, you can directly mutate them to affect all instances of that specific icon. For example, if you want a specific icon to always be a different size, you can do the following:
icons.Anvil.GlobalSize("xs")
// Elsewhere...
icons.Anvil // a call here will also have it size set to xsGlobal Size
GlobalSize sets the global size for this icon:
icons.Anvil.GlobalSize("xs")GlobalStroke
GlobalStroke sets the global stroke for this icon:
icons.Anvil.GlobalStroke("red")GlobalStrokeWidth
GlobalStrokeWidth sets the global stroke width for this icon:
icons.Anvil.GlobalStrokeWidth("2")GlobalAttributes
GlobalAttributes sets the global attributes for this icon:
icons.Anvil.GlobalAttributes(map[string]any{
"@click" : "alert('You just clicked this anvil!')",
})Global Class
GlobalClass is a convience method to apply a class attribute to the icon globally.
icons.Anvil.GlobalClass("text-red-500")Future
Iridium will support different icon packs & allow you to drop in your own in the future. For now, you are limited our templ components derived from lucideicons.