runtime
Low-level StatelyUi runtime configuration and builder.
This module provides the base runtime types and factory function for creating a StatelyUi instance without the core plugin. These are intended for plugin authors and advanced use cases.
For Most Users
Use statelyUi from @statelyjs/stately instead. It includes the
core plugin automatically and provides a simpler API:
For Plugin Authors
Use createStatelyUi when building plugins that need to work with
the base runtime before the core plugin is applied:
Interfaces
RouteOption
Defined in: packages/ui/src/runtime.ts:103
Route and navigation option for an individual route.
Primarily represented in the application's navigation but may be used elsewhere.
Properties
badge?
optionalbadge:ComponentType<Omit<RouteOption,"badge">> |null
Defined in: packages/ui/src/runtime.ts:107
icon?
optionalicon:ComponentType<any>
Defined in: packages/ui/src/runtime.ts:104
label
label:
string
Defined in: packages/ui/src/runtime.ts:105
to
to:
string
Defined in: packages/ui/src/runtime.ts:106
StatelyUiBuilder
Defined in: packages/ui/src/runtime.ts:216
Builder interface for constructing a StatelyUi runtime.
Extends the runtime with withPlugin() for chaining plugin installation.
After all plugins are added, the builder can be used as the runtime.
Extends
StatelyUiRuntime<Schema,Augments>
Type Parameters
Schema
Schema extends StatelySchemas<any, any>
The application's StatelySchemas type
Augments
Augments extends readonly AnyUiPlugin[] = readonly []
Tuple of plugin types that will be installed
Properties
client
readonlyclient:Client<Schema["config"]["paths"]>
Defined in: packages/ui/src/runtime.ts:155
An openapi-fetch client for making API calls
Inherited from
options
readonlyoptions:UiOptions
Defined in: packages/ui/src/runtime.ts:157
UI configuration options
Inherited from
plugins
plugins:
MergeUiAugments<Schema,Augments>
Defined in: packages/ui/src/runtime.ts:178
Installed plugins accessible by name
Inherited from
registry
registry:
UiRegistry
Defined in: packages/ui/src/runtime.ts:174
Component and transformer registry for dynamic rendering
Inherited from
schema
readonlyschema:Stately<Schema>
Defined in: packages/ui/src/runtime.ts:153
The Stately schema instance containing type definitions
Inherited from
utils
utils:
UiUtils
Defined in: packages/ui/src/runtime.ts:176
Utility functions available throughout the application
Inherited from
Methods
withPlugin()
withPlugin(
plugin):StatelyUiBuilder<Schema,Augments>
Defined in: packages/ui/src/runtime.ts:226
Install a plugin into the runtime.
Parameters
plugin
UiPluginFactory<Schema, Augments>
Plugin factory function
Returns
StatelyUiBuilder<Schema, Augments>
Builder with the plugin installed
StatelyUiConfiguration
Defined in: packages/ui/src/runtime.ts:151
Core configuration required to create a StatelyUi runtime.
Type Parameters
Schema
Schema extends StatelySchemas<any, any>
The application's StatelySchemas type
Properties
client
client:
Client<Schema["config"]["paths"]>
Defined in: packages/ui/src/runtime.ts:155
An openapi-fetch client for making API calls
options
options:
UiOptions
Defined in: packages/ui/src/runtime.ts:157
UI configuration options
schema
schema:
Stately<Schema>
Defined in: packages/ui/src/runtime.ts:153
The Stately schema instance containing type definitions
StatelyUiRuntime
Defined in: packages/ui/src/runtime.ts:201
The complete StatelyUi runtime.
Combines the base configuration with plugin-provided runtime additions. This is what gets passed to the StatelyUiProvider and is accessible via the useStatelyUi hook.
Example
Extends
Readonly<StatelyUiConfiguration<Schema>>.UiPluginRuntime<Schema,Augments>
Extended by
Type Parameters
Schema
Schema extends StatelySchemas<any, any>
The application's StatelySchemas type
Augments
Augments extends readonly AnyUiPlugin[] = readonly []
Tuple of plugin types that are installed
Properties
client
readonlyclient:Client<Schema["config"]["paths"]>
Defined in: packages/ui/src/runtime.ts:155
An openapi-fetch client for making API calls
Inherited from
Readonly.client
options
readonlyoptions:UiOptions
Defined in: packages/ui/src/runtime.ts:157
UI configuration options
Inherited from
Readonly.options
plugins
plugins:
MergeUiAugments<Schema,Augments>
Defined in: packages/ui/src/runtime.ts:178
Installed plugins accessible by name
Inherited from
registry
registry:
UiRegistry
Defined in: packages/ui/src/runtime.ts:174
Component and transformer registry for dynamic rendering
Inherited from
schema
readonlyschema:Stately<Schema>
Defined in: packages/ui/src/runtime.ts:153
The Stately schema instance containing type definitions
Inherited from
Readonly.schema
utils
utils:
UiUtils
Defined in: packages/ui/src/runtime.ts:176
Utility functions available throughout the application
Inherited from
UiNavigationOptions
Defined in: packages/ui/src/runtime.ts:116
Navigation configuration for the application.
Controls the sidebar navigation structure, base paths for links, and allows overriding plugin-provided routes.
Properties
basePath?
optionalbasePath:string
Defined in: packages/ui/src/runtime.ts:118
Base path prepended to all navigation links
routeOverrides?
optionalrouteOverrides:Record<string,RouteOption>
Defined in: packages/ui/src/runtime.ts:138
Override specific route configurations by path.
Keys are the original to path, values are the replacement route config.
Useful for customizing plugin-provided navigation items.
Example
routes?
optionalroutes:object&RouteOption
Defined in: packages/ui/src/runtime.ts:120
Primary navigation routes displayed in the sidebar
Type Declaration
items?
optionalitems:RouteOption[]
UiOptions
Defined in: packages/ui/src/runtime.ts:83
App-wide configuration options for StatelyUi.
Configure API path prefixes, navigation structure, and theme settings. These options are available throughout the application via context.
Example
Properties
api?
optionalapi:object
Defined in: packages/ui/src/runtime.ts:85
API configuration options
pathPrefix?
optionalpathPrefix:string
Path prefix prepended to all API calls
navigation?
optionalnavigation:UiNavigationOptions
Defined in: packages/ui/src/runtime.ts:90
Navigation configuration for sidebar and routing
theme?
optionaltheme:object&Partial<Omit<ThemeProviderProps,"children">>
Defined in: packages/ui/src/runtime.ts:92
Theme configuration for light/dark mode
Type Declaration
disabled?
optionaldisabled:boolean
Set to true to disable the theme provider
UiPluginRuntime
Defined in: packages/ui/src/runtime.ts:169
Plugin-provided runtime additions.
Contains the component registry, utility functions, and plugin instances that are added to the runtime through plugins.
Extended by
Type Parameters
Schema
Schema extends StatelySchemas<any, any>
The application's StatelySchemas type
Augments
Augments extends readonly AnyUiPlugin[] = readonly []
Tuple of plugin types that are installed
Properties
plugins
plugins:
MergeUiAugments<Schema,Augments>
Defined in: packages/ui/src/runtime.ts:178
Installed plugins accessible by name
registry
registry:
UiRegistry
Defined in: packages/ui/src/runtime.ts:174
Component and transformer registry for dynamic rendering
utils
utils:
UiUtils
Defined in: packages/ui/src/runtime.ts:176
Utility functions available throughout the application
Variables
defaultUiOptions
constdefaultUiOptions:UiOptions
Defined in: packages/ui/src/runtime.ts:144
Default UI options applied when not specified.
Functions
createStatelyUi()
createStatelyUi<
Schema,Augments>(config):StatelyUiBuilder<Schema,Augments>
Defined in: packages/ui/src/runtime.ts:267
Create a new base StatelyUi runtime builder (without core plugin).
This is a low-level API for plugin authors and advanced use cases.
It returns a builder that allows chaining plugin installations via withPlugin().
For Most Users
Use statelyUi from @statelyjs/stately instead, which includes
the core plugin automatically:
For Plugin Authors
Use this when you need the base runtime without core:
Type Parameters
Schema
Schema extends StatelySchemas<any, any>
The application's StatelySchemas type
Augments
Augments extends readonly AnyUiPlugin[] = readonly []
Tuple of plugin types that will be installed
Parameters
config
Readonly<StatelyUiConfiguration<Schema>>
Core configuration with schema, client, and options
Returns
StatelyUiBuilder<Schema, Augments>
A builder for installing plugins and creating the runtime