Skip to content

Navigation Menu

Sign in
Sign up

Plugins

Emilio Romero edited this page Jun 3, 2026 · 13 revisions

Create custom plugins for Umbra

Plugins allow you to extend Umbra with custom UI components or behavior.

Interface

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;
}

Lifecycle

  1. Constructor - Plugin is instantiated with the Umbra instance as host
  2. render() - Called during initialization
  3. onThemeChange() - Called whenever the theme changes (including sync from other tabs)
  4. onDestroy() - Called when umbra.destroy() is invoked

Accessing methods

The host parameter is your Umbra instance. You can call:

class MyPlugin implements Plugin {
 public static readonly pluginId = 'd-<something>'; // Required
 private host: any;
 constructor(host: any) {
 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);
 }
}

Clone this wiki locally

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /