Skip to content

API Reference

@theme-kit/vue

Vue 3 provider, composables and scopes over the shared runtime.

Functions

createVueThemeBootstrapScript<T extends ThemeDefinition<string>>(options): string

Build the blocking zero-flash <head> script for a Vue app (SSR or SPA).

Inlines core's createThemeBootstrapScript with the Vue defaults (storageKey: "theme-selection", prefix: "theme-" — the same values the Vue ThemeProvider persistence and CSS variables use), so the persisted theme is applied before first paint. Emit the returned string as a blocking <script> inside <head>.

ParameterTypeDescription
optionsThemeBootstrapScriptOptions<T>

Returns string


provideThemeRuntime<T extends ThemeDefinition<string>>(runtime): void

ParameterTypeDescription
runtimeThemeRuntime<T>

Returns void


useBootstrapTheme<T extends ThemeDefinition<string>>(options): ThemeAdapter<T>

Vue composable that installs the Bootstrap adapter onto the active Theme Kit runtime. Maintains a tagged :root style element with concrete --bs-* variables (including -rgb triplets), kept in sync as the active theme changes.

ParameterTypeDescription
optionsUseAdapterOptions

Returns ThemeAdapter<T>


useDaisyTheme<T extends ThemeDefinition<string>>(options): ThemeAdapter<T>

Vue composable that installs the daisyUI adapter onto the active Theme Kit runtime. Maintains a tagged :root style element with concrete --color-* variables, kept in sync as the active theme changes.

ParameterTypeDescription
optionsUseAdapterOptions

Returns ThemeAdapter<T>


useOpenPropsTheme<T extends ThemeDefinition<string>>(options): ThemeAdapter<T>

Vue composable that installs the Open Props adapter onto the active Theme Kit runtime. Maintains a tagged :root style element with concrete --brand, --link, --size-* and related variables, kept in sync as the active theme changes.

ParameterTypeDescription
optionsUseAdapterOptions

Returns ThemeAdapter<T>


useShadcnTheme<T extends ThemeDefinition<string>>(options): ThemeAdapter<T>

Vue composable that installs the shadcn/ui adapter onto the active Theme Kit runtime. Maintains a tagged :root style element with concrete --* variables, kept in sync as the active theme changes.

Call once in your app root:

ts
1import { useShadcnTheme } from "@theme-kit/vue";
2
3function App() {
4  useShadcnTheme();
5  return <YourApp />;
6}
ParameterTypeDescription
optionsUseAdapterOptions

Returns ThemeAdapter<T>


useTheme<T extends ThemeDefinition<string>>(): { family: Ref<string, string>; mode: Ref<ThemeMode, ThemeMode>; setFamily: __type(nextFamily: string): void; setMode: __type(nextMode: ThemeMode): void; theme: Ref<T, T>; toggleTheme: __type(): void }

Returns { family: Ref<string, string>; mode: Ref<ThemeMode, ThemeMode>; setFamily: __type(nextFamily: string): void; setMode: __type(nextMode: ThemeMode): void; theme: Ref<T, T>; toggleTheme: __type(): void }


useThemeBatch(): __type(callback: __type(): void): void

Returns __type(callback: __type(): void): void


useThemeFamily(): Ref<string, string>

Returns Ref<string, string>


useThemeHistory<T extends ThemeDefinition<string>>(): { canRedo: Ref<boolean, boolean>; canUndo: Ref<boolean, boolean>; clear: __type(): void; history: Ref<readonly { theme: UnwrapRef; timestamp: number }[], readonly HistoryEntry<T>[] | readonly { theme: UnwrapRef; timestamp: number }[]>; jump: __type(index: number): void; redo: __type(): void; undo: __type(): void }

Returns { canRedo: Ref<boolean, boolean>; canUndo: Ref<boolean, boolean>; clear: __type(): void; history: Ref<readonly { theme: UnwrapRef; timestamp: number }[], readonly HistoryEntry<T>[] | readonly { theme: UnwrapRef; timestamp: number }[]>; jump: __type(index: number): void; redo: __type(): void; undo: __type(): void }


useThemeLifecycle(): { on: __type(event: keyof ThemeLifecycleEventMap<ThemeDefinition<string>>, listener: __type(data: unknown): void): __type(): void }

Returns { on: __type(event: keyof ThemeLifecycleEventMap<ThemeDefinition<string>>, listener: __type(data: unknown): void): __type(): void }


useThemeMode(): Ref<ThemeMode, ThemeMode>

Returns Ref<ThemeMode, ThemeMode>


useThemePacks(): __type(pack: ThemePack<any>): void

Returns __type(pack: ThemePack<any>): void


useThemeRestore(): __type(snapshot: ThemeRuntimeSnapshot<ThemeDefinition<string>>): void

Returns __type(snapshot: ThemeRuntimeSnapshot<ThemeDefinition<string>>): void


useThemeRuntime<T extends ThemeDefinition<string>>(): ThemeRuntime<T>

Returns ThemeRuntime<T>


useThemeSchedule<T extends ThemeDefinition<string>>(): ThemeScheduleController

Reactive access to the runtime's sunrise/sunset scheduling controller.

Requires the runtime (or <ThemeProvider>) to be created with the scheduled option. The returned state ref tracks enabled, status, active, sunrise/sunset and the next transition; enable()/disable() /set() control the engine.

vue
<script setup lang="ts">
const schedule = useThemeSchedule();
</script>

Returns ThemeScheduleController


useThemeSnapshot(): __type(): ThemeRuntimeSnapshot<ThemeDefinition<string>>

Returns __type(): ThemeRuntimeSnapshot<ThemeDefinition<string>>


useThemeTokens<T extends ThemeDefinition<string>>(): Ref<ThemeTokens | undefined, ThemeTokens | undefined>

Returns Ref<ThemeTokens | undefined, ThemeTokens | undefined>


useThemeValue<T extends ThemeDefinition<string>>(): Ref<T, T>

Returns Ref<T, T>


Interfaces

ThemeInspectorProps

MemberTypeDescription
bottom (optional)numberDistance from the bottom of the viewport, in px. Default 104.
right (optional)numberDistance from the right edge of the viewport, in px. Default 32.
size (optional)numberToggle button size, in px. Default 40.
zIndex (optional)numberZ-index for the floating toggle and panel. Default 9999.

ThemeProviderProps<T extends ThemeDefinition>

Extends ThemeRuntimeOptions<T>

MemberTypeDescription
adapters (optional)ThemeAdapter<T>[]Library adapters installed when the runtime is created. The runtime owns
the registry and notifies every adapter whenever the theme changes; it
never knows anything about the libraries themselves.
broadcast (optional)`ThemeSelectionBroadcastAdapternull`
cssVariables (optional)`falseCSSVariablesOptions`
defaultTheme (optional)T["name"]
dom (optional)`falseDOMBindingOptions`
initial (optional)InitialThemeResolution<T>
initialFamily (optional)string
initialMode (optional)ThemeMode
persistence (optional)`ThemeSelectionPersistenceAdapternull`
plugins (optional)ThemePlugin<T>[]
readPersistenceOnInit (optional)boolean
runtime (optional)ThemeRuntime<T>
scheduled (optional)`falseScheduledThemeOptions<T>`
themes (optional)readonly T[]
transition (optional)`booleanThemeTransitionOptions`
view (optional)Window

ThemeScheduleController

MemberTypeDescription
disable__type(): void
enable__type(): void
schedule`ThemeSchedulenull`
option). Methods below are safe no-ops in that case.
set__type(options: ThemeScheduleSetOptions): void
stateRef<ThemeScheduleState>Reactive state snapshot: enabled, active, status, sunrise,
sunset, nextTransition, nextActivation, nextDeactivation.

ThemeScopeProps

MemberTypeDescription
family (optional)stringTheme family for the scoped subtree. Without mode, follows the
provider's current mode.
mode (optional)ThemeModeMode for a family-based scope. Defaults to the provider's current mode.
theme (optional)stringExact theme name or family name. When family/mode are also set,
theme wins. Omit to follow the provider's selection inside a boundary.
themes (optional)readonly ThemeDefinition<string>[]Local theme definitions — resolved first, parent registry falls back.
No second runtime is created.
transition (optional)`booleanThemeTransitionOptions`
false disables it, an object is merged over the provider config.

ThemeScrollbarProps

Extends OverlayScrollbarOptions

MemberTypeDescription
activeThumbColor (optional)stringCustom thumb color while the user is dragging it. When set,
overrides the theme-derived active color. Default undefined
(uses thumbColor or theme-derived).
animationDuration (optional)numberrAF easing time constant (ms) for smooth thumb travel. Default 180.
arrowDownIcon (optional)ArrowIconContent for the "scroll down" button. Falls back to arrowIcon.
arrowIcon (optional)ArrowIconOptional content shown inside every arrow button (overrides the built-in
CSS triangle). Accepts an innerHTML string, a DOM node (element / inline
SVG / text) or an array of both.
arrowIconRenderer (optional)__type(button: HTMLDivElement, dir: ScrollbarArrowDir): voidFramework hook: invoked for every arrow button that has custom content, so
framework wrappers (React/Vue/Svelte/...) can render framework-owned
elements (JSX/VNodes/...) into the button. When set it replaces the
innerHTML/node injection for arrowIcon-style options.
arrowLeftIcon (optional)ArrowIconContent for the "scroll left" button. Falls back to arrowIcon.
arrowRightIcon (optional)ArrowIconContent for the "scroll right" button. Falls back to arrowIcon.
arrows (optional)booleanShow the up/down (or left/right) navigation buttons like native browser
scrollbars. Clicking scrolls a step; holding repeats. Default true.
arrowUpIcon (optional)ArrowIconContent for the "scroll up" button. Falls back to arrowIcon.
autoHide (optional)booleanFade the thumb/track out while idle. Default true (macOS-style).
autoHideDelay (optional)numberIdle (ms) before a revealed strip fades out after its last activity.
Each host has its own timer, so only the strip you're scrolling/hovering
is revealed, then it fades after idle; other scrollbars stay hidden.
Default 900. Only takes effect when autoHide is true.
axes (optional)ScrollbarAxis[]Which axes to render. Defaults to both.
clickToJump (optional)booleanClicking the empty track scrolls smoothly to that position. Default true.
dir (optional)`"ltr""rtl"
draggable (optional)booleanAllow dragging the thumb to scroll. Default true.
duration (optional)numberCSS transition duration (ms) for thickness/opacity/color. Default 250.
exclude (optional)`string[]null`
hoverExpand (optional)booleanGrow the strip on hover / drag. Default false (thickness stays
constant so the scrollbar never shifts while scrolling).
hoverThickness (optional)numberThumb thickness while hovered / dragged — only used when hoverExpand is true. Default thickness + 4.
include (optional)`string[]null`
always tracked). When empty, all scrollable elements are tracked.
minThumbSize (optional)numberMinimum thumb travel size. Default 32.
offset (optional)numberGap between the thumb and the container edge in px. Default 2.
overscroll (optional)booleanSubtly compress the thumb at the scroll boundaries (rubber-band feel). Default true.
radius (optional)numberThumb corner radius in px. Default 999.
smooth (optional)booleanUse rAF-lerped (eased) thumb motion instead of a hard snap. Default true.
tag (optional)string
thickness (optional)numberResting thumb thickness (width for vertical, height for horizontal). Default 8.
thumbColor (optional)stringCustom thumb color (any CSS color string). When set, overrides
the theme-derived color. Default undefined (theme-derived).
thumbHoverColor (optional)stringCustom thumb color while hovered. When set, overrides the
theme-derived hover color. Default undefined (uses thumbColor
or theme-derived).
thumbOpacity (optional)numberThumb opacity while visible. Default 0.7.
touch (optional)booleanNative (touch) devices: keep native scrollbars by default. Pass true to
force the overlay on coarse-pointer devices. Default false.
trackColor (optional)stringCustom track color (any CSS color string). When set, overrides
the theme-derived color. Default undefined (theme-derived).
trackOpacity (optional)numberTrack strip opacity (0 = invisible). Default 0.25.
zIndex (optional)numberZ-index for the overlay strips. Defaults to the tracked container's own
z-index (so the scrollbar stays inside its container's stacking order —
e.g. below a sticky header). The document scrollbar defaults to 55
(above typical sticky headers, below full-screen modal backdrops) and
containers without a z-index default to 30. Overriding lets you force
scrollbars above fixed headers/modals if you need to.

UseAdapterOptions

MemberTypeDescription
strategy (optional)AdapterStrategy

Variables

ThemeInspector

Component & { install: void }


ThemeKitSymbol

InjectionKey<ThemeRuntime<any>>


ThemeProvider

Component & { install: void }


ThemeScope

Component & { install: void }


ThemeScrollbar

Component & { install: void }


@theme-kit/vue — API Reference — Theme Kit