swirl framework
intro
wow's addon api gives you frames, textures, and font strings, and not much else. there's no layout system and no standard set of controls, so every addon builds its own buttons, dropdowns, and settings windows.
swirl framework is my set of those pieces, written once and shared by my addons. it's open source under the mit license.
why i built it
instance loadouts used to build its ui on abstractframework, another addon's framework. wago doesn't allow packaging another addon inside yours, so users had to install it separately, and the readme needed a note explaining that.
i wrote this to replace it, and moved instance loadouts over the same day. swirlui core uses it too.
what's in it
- window: a movable window with a header, icon, title, page title, close button, and an optional settings gear. it can size itself to its content
- layout: vertical tabs, cards with titles and dividers, and a scrollbar that can attach to any scroll frame
- controls: buttons, icon buttons, toggles, sliders, dropdowns, text boxes, color pickers, and an x/y position control
- notifications: toasts, and confirm dialogs that can dim and attach to a window


how it works
embedding
each addon embeds its own copy: it lists the framework as an external in its packaging config, and the packager copies it into the addon's UI folder:
externals:
UI:
url: https://github.com/lolswirl/SwirlFramework
branch: mainevery file starts with local _, SF = ..., which gives it the host addon's private namespace instead of a global. so each addon carries its own copy, and two addons on different versions of the framework can't conflict.
theme
colors, fonts, padding, and sizes all come from one theme table. components read from it instead of hard-coding values, so a change there applies everywhere.
the accent color follows your class. at load time the theme replaces its default accent with your class color, plus a dimmed and a faded version of it:
function SF.InitTheme()
local _, class = UnitClass("player")
local cc = RAID_CLASS_COLORS[class]
T.accent = CreateColor(cc.r, cc.g, cc.b, 1)
T.accentDim = CreateColor(cc.r * 0.6, cc.g * 0.6, cc.b * 0.6, 1)
T.accentFade = CreateColor(cc.r, cc.g, cc.b, 0.20)
enda shaman sees blue, a monk green, a demon hunter purple, and a death knight red, in every addon built on it.




stack
built with: lua, world of warcraft addon api
used by: instance loadouts, swirlui core
size: ~2.2k lines across 21 files