Skip to main content
These hooks provide access to shell services from within plugin UI components. The first four are thin wrappers around usePluginContext() fields, exported as focused hooks for readability; useTheme follows the theme Stratos is showing.

Import


useShellNavigation

Access the shell’s navigation helpers. All navigation is handled by the shell’s router: plugins do not manage their own history.

Signature

See PluginNavigationHelper for the full shape.

Methods

Usage


useShellToast

Trigger toast notifications using the shell’s toast system. All toasts appear in the shell’s notification area: plugins do not render their own toast containers.

Signature

See PluginToastAPI for the full shape.

Usage


useShellConfig

Read plugin-namespaced config values synchronously. The config store is namespaced to the current plugin: two plugins using the same key will not conflict.

Signature

See PluginConfigStore for the full shape. Note: The UI-side config store provides synchronous reads (values are preloaded into context). This differs from the background PluginContext.config, which has async get, set, delete, and getAll methods.

Usage


usePluginLogger

Access a scoped logger that routes log output to the shell’s logging infrastructure. Log entries are prefixed with the plugin ID and written to the daily log file alongside all other Stratos logs.

Signature

See PluginLogger for the full shape.

Parameters

Both category and message are required. The category should be the component or service name: it appears in the log entry alongside the plugin ID prefix.

Usage

Never use console.* directly

Plugin components must use usePluginLogger rather than console.log, console.error, etc. The logger writes to the structured log file, applies secret sanitisation, and includes the plugin ID prefix for easy filtering.

useTheme

The theme Stratos is showing, "light" or "dark", with “system” already resolved to whichever the OS is in. Your component renders again whenever it changes. Most of your UI doesn’t need it, because the Tailwind theme tokens switch on their own. Use it for what CSS can’t reach, like an airline logo with light and dark versions. For a map, use StratosMap, which does this for you.

Signature

Usage

Read the theme with the hook, not once from the page while rendering: that value goes stale when the theme changes and stays wrong until something else renders the component.