Skip to content
3 Death Saves

Widgets

Wiki updated as of 1.4.10 (Nov 2026)

A module can add buttons and indicators to the HUD, MiniCal, and BigCal, or replace one of Calendaria’s own indicators with markup of its own.


PointLocation
hud.buttons.leftLeft side of the HUD bar
hud.buttons.rightRight side of the HUD bar
hud.indicatorsIndicator row of the HUD bar, MiniCal, and BigCal
hud.trayHUD time controls tray
minical.sidebarMiniCal sidebar
bigcal.actionsBigCal action bar

Read these from CALENDARIA.api.widgetPoints.

Any widget type can go at any point.

Despite its name, hud.indicators renders in the indicator rows of the HUD, MiniCal, and BigCal header. Its render function receives 'hud', 'minical', or 'bigcal' to match. The MiniCal indicator row is drawn whenever a widget targets this point, even when no built-in indicator is enabled.

The HUD tray is built only for users with the Change Date/Time permission, so widgets at hud.tray are absent for everyone else.


Element IDDescription
weather-indicatorWeather condition display
season-indicatorCurrent season display
era-indicatorEra/year display
cycle-indicatorCycle (zodiac, etc.) display

Read these from CALENDARIA.api.replaceableElements. A replacement takes over that indicator in the HUD, MiniCal, and BigCal alike.


Widgets registered during calendaria.ready appear on the first render of every Calendaria application.

Hooks.once('calendaria.ready', () => {
CALENDARIA.api.registerWidget('my-module', {
id: 'my-button',
type: 'button',
insertAt: 'hud.buttons.right',
icon: 'fas fa-star',
label: 'My Button',
tooltip: 'Click to do something',
onClick: () => {
console.log('Button clicked!');
}
});
});

registerWidget returns true on success. It returns false with a console warning when moduleId or config.id is missing, when it names neither insertAt nor replaces or names an unrecognized one, when moduleId.id is already registered, or when another widget already replaces that element. There is no call to unregister a widget.

An indicator renders from its icon, label, color, and tooltip properties:

CALENDARIA.api.registerWidget('my-module', {
id: 'mana-indicator',
type: 'indicator',
insertAt: 'hud.indicators',
icon: 'fas fa-gem',
label: 'Mana: 50',
color: '#3aa0ff',
tooltip: 'Current mana',
onAttach: (element) => {
// Called when the widget is added to the DOM
}
});

A type: 'custom' widget supplies a render function. The function receives the location string ('hud', 'minical', or 'bigcal') and returns an HTML string, which Calendaria wraps in a <div class="calendaria-widget-custom">:

CALENDARIA.api.registerWidget('my-module', {
id: 'mana-display',
type: 'custom',
insertAt: 'hud.indicators',
render: (location) => {
return `
<span class="indicator-icon"><i class="fas fa-gem"></i></span>
<span class="indicator-label">Mana: 50</span>
`;
},
onAttach: (element) => {
// Called when the widget is added to the DOM
}
});

A replacement that needs a render function must use type: 'custom'. The render function receives the location string and returns an HTML string:

CALENDARIA.api.registerWidget('my-module', {
id: 'custom-weather',
type: 'custom',
replaces: 'weather-indicator',
render: (location) => {
const weather = CALENDARIA.api.getCurrentWeather();
return `<span>Custom: ${weather?.label || 'None'}</span>`;
}
});

Set disabled: true on a replaces widget to hide the built-in element and render nothing in its place. It works for any widget type, and it is ignored on a widget registered with insertAt.


PropertyTypeDescription
idstringUnique widget identifier within your module
typestring'button', 'indicator', or 'custom'

One of these is required:

PropertyTypeDescription
insertAtstringWidget point ID from widgetPoints
replacesstringElement ID from replaceableElements
PropertyTypeDescription
iconstring | functionFontAwesome icon class
labelstring | functionButton text, rendered only when no icon is supplied
tooltipstring | functionHover tooltip text
colorstring | functionIcon color, as a CSS color value
onClickfunctionClick handler, receives the event
PropertyTypeDescription
iconstring | functionFontAwesome icon class
labelstring | functionIndicator text
colorstring | functionColor of the icon and the label, as a CSS color value
tooltipstring | functionHover tooltip text
onClickfunctionClick handler, receives the event. Also adds a clickable class that switches the cursor to a pointer.
onAttachfunctionCalled with the DOM element when the widget is attached
PropertyTypeDescription
renderfunctionReceives the location string and returns an HTML string
onClickfunctionClick handler, receives the event. Bound to the wrapper, so a click anywhere in your markup reaches it.
onAttachfunctionCalled with the DOM element when the widget is attached

On button and indicator widgets, icon, label, color, and tooltip each accept a function, which Calendaria calls on every render. Custom widgets ignore these four.

onAttach runs after every render of the host application, not only the first. A widget at hud.indicators is attached separately in each application it appears in.


// Get all widgets at a specific point
const hudButtons = CALENDARIA.api.getRegisteredWidgets('hud.buttons.right');
// Get widget replacing a specific element
const weatherWidget = CALENDARIA.api.getWidgetByReplacement('weather-indicator');
// Force all widgets to re-render
CALENDARIA.api.refreshWidgets();

Widget hooks are documented in Hooks > Widget Hooks:

  • calendaria.widgetRegistered - Fired when a widget is registered
  • calendaria.widgetsRefresh - Fired when widgets are refreshed

Every widget carries a class built from its module ID, plus a structural class for its type. Buttons get calendaria-widget, indicators get calendaria-widget-indicator and wrap any label text in a .widget-label span, and custom widgets get the calendaria-widget-custom wrapper.

Button widgets also get a base class for their application: btn in the HUD, sidebar-btn in the MiniCal sidebar, and none in the BigCal action bar. The built-in MiniCal sidebar buttons use a different class, so style MiniCal sidebar widgets yourself.

/* Style all widgets from your module */
.widget-my-module {
/* Your styles */
}
/* Style a specific widget */
.widget-my-module[data-widget-id='my-module.my-button'] {
/* Your styles */
}

The data-widget-id attribute holds the fully-qualified id (moduleId.id).

The color property is written inline as a --widget-color custom property, which Calendaria’s rules read for the icon and label. Without a registered color, a widget picks up any --widget-color your stylesheet sets.


my-module.js
Hooks.once('calendaria.ready', ({ api }) => {
// Add a button to show party resources
api.registerWidget('my-module', {
id: 'party-resources',
type: 'button',
insertAt: 'hud.buttons.right',
icon: 'fas fa-coins',
tooltip: 'Party Resources',
onClick: () => openResourceTracker()
});
// Add a custom widget
api.registerWidget('my-module', {
id: 'party-gold',
type: 'custom',
insertAt: 'hud.indicators',
render: (location) => {
const gold = getPartyGold();
return `
<span class="indicator-icon"><i class="fas fa-coins" style="color: gold;"></i></span>
<span class="indicator-label">${gold} gp</span>
`;
}
});
// Update the widget when gold changes
Hooks.on('updatePartyGold', () => {
api.refreshWidgets();
});
});