LibDBIcon for Beginners

Here's how to replace your old and clunky minimap button with a sleek and flashy new one with the standard LibDBIcon library. This guide is designed for beginners who may never have used a library before.


After I revamped the enhance minimap setting in Leatrix Plus, I loved the new features but I found it frustrating that around 20% of addons use incompatible custom minimap buttons rather than the standard, fully compatible LibDBIcon buttons.

After talking with some addon authors, it became clear that some use custom buttons simply because they don't know how to use LibDBIcon. Some had never used a library before. So here is a guide designed for beginners.

Why do I need LibDBIcon?

LibDBIcon is a standard way of adding a minimap button to your addon. It supports all minimap shapes, sizes and on-hover functionality out of the box. Over 80% of addons use LibDBIcon for their minimap buttons. Why doesn't yours?

As LibDBIcon has become a standard, minimap replacement addons work best with LibDBIcon buttons. If you don't use LibDBIcon, some minimap replacement addon functionality might not work with your button.

Adding a LibDBIcon button is a really quick and painless process (as you will see below) because FunkyDude has done all the work for you. All you really have to do is give your button a name and tell it where to save its position and show status. It's that simple.

With LibDBIcon, your minimap button code is short and sweet. Without it, you will be needlessly duplicating reams of code and after you have finished, your custom button still won't be as good as a LibDBIcon button.

The LibDBIcon library is only run once by the first addon that loads it. Once loaded, all other addons use that same copy of it in memory.

So what are you waiting for?

In this example, I'm creating a LibDBIcon button for an addon called MyLittleAddon. The addon saves its settings in a table called MyLittleAddonDB.

Get LibDBIcon.

Download LibDBIcon from CurseForge.

Put LibDBIcon in your addon's folder.

Extract the zip file and copy the LibDBIcon-1.0 folder to your addon's folder. My addon folder is called MyLittleAddon so the LibDBIcon-1.0 folder goes inside it. The folder structure should be Interface\AddOns\MyLittleAddon\LibDBIcon-1.0\CallbackHandler-1.0, etc.

Import the LibDBIcon library.

Just add LibDBIcon-1.0\embeds.xml to your addon's .toc file so that it runs before anything else. Like this:

## Title: MyLittleAddon

## Interface: 90105

## Version: 9.1.00

## SavedVariables: MyLittleAddonDB



Create the LibDBIcon.

This is the button code that you need to enter in your addon's .lua file. MyLittleAddon should be replaced with your addon name and MyLittleAddonDB should be replaced with the name of your saved variables table (both of these are in your .toc file).

local miniButton = LibStub("LibDataBroker-1.1"):NewDataObject("MyLittleAddon", {

type = "data source",

text = "My Little Addon",

icon = "Interface\\HELPFRAME\\HelpIcon-KnowledgeBase",

OnClick = function(self, btn)

-- OnClick code goes here


OnTooltipShow = function(tooltip)

if not tooltip or not tooltip.AddLine then return end

tooltip:AddLine("My Little Addon")



local icon = LibStub("LibDBIcon-1.0", true)

icon:Register("MyLittleAddon", miniButton, MyLittleAddonDB)

Toggle your new LibDBIcon.

Your button will be shown by default but this is how you manually show it. To hide it, set "hide" to true and change icon:Show to icon:Hide. Replace MyLittleAddonDB with your addon's saved variables table.

MyLittleAddonDB["hide"] = false


That's all there is to it.

Your icon position and show status will automatically be saved in your addon's saved variables table like this:

["minimapPos"] = 171.78246154272,

["hide"] = false,

Now your button is working, you can change the icon texture and edit the OnClick and OnTooltipShow functions so the button looks and behaves how you want it to.

Updating LibDBIcon in your addon's folder.

You should update LibDBIcon in your addon's folder when FunkyDude releases an update (follow the project on CurseForge to be notified of updates).

However, if you prefer, you don't have to include the LibDBIcon library in your addon's folder at all. You can simply specify that the latest version of LibDBIcon should be packaged with your addon automatically. However, that is beyond the scope of this guide which is designed for complete beginners.

Thank the author.

Thanks to Funkydude for creating LibDBIcon so that all addons can benefit from a standard minimap button library.