Widget Spec
A “widget” in the Baz suite is a plain Lua table describing a frame to host. There’s no constructor — you populate the fields you need and pass the table to the registry.
Required fields
Section titled “Required fields”| Field | Type | Description |
|---|---|---|
id | string | Unique widget id. Convention: <addon>_<name> (e.g. bazwidgets_repair). |
frame | Frame | The actual Frame object the host will parent. |
Display fields (recommended)
Section titled “Display fields (recommended)”| Field | Type | Description |
|---|---|---|
label | string | Title bar text. |
icon | string|table | Texture path or atlas info. |
designWidth | number | Native width — host scales to fit. |
designHeight | number | Initial height hint. |
source | string | Free-form provenance label, e.g. "LibDataBroker". |
tags | array | Small chips next to the label, each { text, color }. |
Lifecycle methods
Section titled “Lifecycle methods”These are optional methods you put on the widget table (or its frame). The host calls them when present.
| Method | When called |
|---|---|
widget:GetDesiredHeight() -> number | Whenever the host reflows. Return your dynamic height. |
widget:GetStatusText() -> text, r, g, b | When the title bar’s status segment refreshes. |
widget:GetOptionsArgs() -> table | When the host builds the per-widget options page. AceConfig-style table. |
widget:OnDock(host) | When the widget is parented into a drawer. |
widget:OnUndock() | When the widget is detached or unregistered. |
Triggering a reflow
Section titled “Triggering a reflow”If your widget’s height changes (collapsing a section, switching layouts), tell the host so it can rebuild the slot stack:
local bd = BazCore:GetAddon("BazWidgetDrawers")if bd and bd.WidgetHost then bd.WidgetHost:Reflow()endFor status-text-only changes, use WidgetHost:UpdateWidgetStatus(widgetId) instead — it’s lighter than a reflow.
Minimal example
Section titled “Minimal example”local f = CreateFrame("Frame", nil, UIParent)f:SetSize(200, 22)f.text = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")f.text:SetPoint("LEFT", 6, 0)f.text:SetText("Hello")
local widget = { id = "myaddon_hello", label = "Hello", icon = "Interface\\Icons\\inv_misc_book_09", designWidth = 200, designHeight = 22, frame = f, GetStatusText = function(self) return f.text:GetText() or "", 1, 0.82, 0 end,}
BazCore:RegisterDockableWidget(widget)Continue to Publishing Widgets for the full publisher API and dormant widgets.