API Reference
@themvora/open-props
Open Props adapter: map theme tokens onto Open Props custom properties.
Exports the React-free createOpenPropsAdapter factory (also available from
@themvora/open-props/factory), the createOpenPropsVariables generator,
and the injectOpenPropsCSS helper. Framework wrappers live on their own
subpaths: useOpenPropsTheme(runtime) on @themvora/open-props/react, and
equivalent composables/injectables on /vue, /svelte, /solid, and
/angular.
Generated from
packages/open-props/srcbyapps/docs/scripts/generate-api-reference.mjs. Do not edit by hand — runpnpm --filter @themvora/docs api:generate.
Functions
createOpenPropsAdapter<T extends ThemeDefinition<string>>(options): ThemeAdapter<T>
Creates an Open Props adapter.
The adapter is a DOM-only, framework-free adapter: it depends only on
@themvora/core and the DOM. On install it injects the Open Props
compatibility stylesheet (when enabled) and a <style> element of CSS
variables derived from the active theme, then subscribes to the runtime
store and rewrites the variables whenever the theme selection changes. It
does not render any component or require a React tree.
On uninstall it removes the injected styles and unsubscribes from the store.
See also: useOpenPropsTheme
| Parameter | Type | Description |
|---|---|---|
options | CreateOpenPropsAdapterOptions | Adapter options. Defaults to {}. |
Returns ThemeAdapter<T> — A ThemeAdapter for Open Props.
import { createOpenPropsAdapter } from "@themvora/open-props";
runtime.adapters.use(createOpenPropsAdapter());createOpenPropsVariables(tokens): Record<string, string>
Programmatic alternative to open-props.css. Returns concrete Open Props
CSS variable values for a given set of Themvora tokens.
| Parameter | Type | Description |
|---|---|---|
tokens | ThemeTokens | — |
Returns Record<string, string>
injectOpenPropsCSS(): void
Injects the Open Props compatibility CSS (idempotent, SSR-safe). Called
automatically the first time useOpenPropsTheme installs an adapter.
Returns void
Interfaces
CreateOpenPropsAdapterOptions
Extends OpenPropsAdapterOptions
Options for createOpenPropsAdapter.
See also: createOpenPropsAdapter
| Member | Type | Description |
|---|---|---|
injectCSS (optional) | boolean | Whether to inject the Open Props compatibility stylesheet. Defaults to true. |
plugins (optional) | AdapterPlugin[] | Adapter plugins that customize how the Open Props CSS variables are generated. Defaults to no plugins. |
strategy (optional) | AdapterStrategy | How faithfully the adapter reproduces Open Props' native feel. |
OpenPropsAdapterOptions
Options for the Open Props adapter.
See also: createOpenPropsAdapter
| Member | Type | Description |
|---|---|---|
injectCSS (optional) | boolean | Whether to inject the Open Props compatibility stylesheet. Defaults to true. |
strategy (optional) | AdapterStrategy | How faithfully the adapter reproduces Open Props' native feel. |
Related docs
- Open Props — the adapter integration