Skip to main content

Overview

Plugins can inject CSS into the document. By default, CSS is scoped to the plugin’s container for safety. Opt-in to global injection when needed.

api.injectCSS(pluginId, css, options?)

Inject a <style> element for a plugin.

Signature

Returns: HTMLStyleElement — the created <style> element

Scoping Behavior

When global is false (default), CSS is wrapped:
This ensures your styles only affect your plugin’s container.
If called again with the same pluginId, the previous style element is replaced — not duplicated.

api.removeCSS(pluginId)

Remove a plugin’s injected styles.

Teardown

Always clean up CSS in your teardown() function:

Full Example