-
Notifications
You must be signed in to change notification settings - Fork 0
Plugins
Emilio Romero edited this page Jun 5, 2026
·
9 revisions
Plugins allow you to extend Umbra with custom UI components or behavior.
export interface Plugin<T extends HTMLElement = HTMLElement> {
// Optional: Element rendered by the plugin
el?: T;
// Required: Render the plugin UI
render(): void | T;
// Optional: Called when theme changes
onThemeChange?: (theme: string) => void;
// Optional: Called when Umbra is destroyed
onDestroy?: () => void;
}-
Constructor - Plugin is instantiated with the Umbra instance as
host - render() - Called during initialization
- onThemeChange() - Called whenever the theme changes (including sync from other tabs)
-
onDestroy() - Called when
umbra.destroy()is invoked
The host parameter is your Umbra instance. You can call:
class MyPlugin implements Plugin {
public static readonly pluginId = 'u-<something>'; // Required
private host: Host;
constructor(host: Host) {
this.host = host;
// Access: host.theme, host.toggleTheme(), host.getCurrentTheme()
}
render(): void | HTMLElement {
throw new Error("Method not implemented.");
}
onThemeChange(theme: string): void {
console.log('Theme changed to:', theme);
}
}- keyboard-shortcut: this plugin adds keyboard shortcut handling