Skip to content

API Reference

@theme-kit/solid

Solid provider, signals and scopes with fine-grained reactivity.

Functions

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

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

Inlines core's createThemeBootstrapScript with the Solid defaults (storageKey: "theme-selection", prefix: "theme-" — the same values the Solid 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


ThemeInspector(props): Element

ParameterTypeDescription
propsThemeInspectorProps

Returns Element


ThemeProvider<T extends ThemeDefinition<string>>(props): Element

ParameterTypeDescription
propsThemeProviderProps<T>

Returns Element


ThemeScope(props): Element

ParameterTypeDescription
propsThemeScopeProps

Returns Element


ThemeScrollbar(props): null

ParameterTypeDescription
propsThemeScrollbarProps

Returns null


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

Solid 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>

Solid 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>

Solid 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>

Solid 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:

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

Returns ThemeAdapter<T>


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

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


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

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


useThemeFamily(): Accessor<string>

Returns Accessor<string>


useThemeHistory<T extends ThemeDefinition<string>>(): { clear: __type(): void; jump: __type(index: number): void; redo: __type(): void; undo: __type(): void; canRedo: void; canUndo: void; history: void }

Returns { clear: __type(): void; jump: __type(index: number): void; redo: __type(): void; undo: __type(): void; canRedo: void; canUndo: void; history: 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(): Accessor<ThemeMode>

Returns Accessor<ThemeMode>


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

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


useThemeRestore(): __type(snapshot: ThemeRuntimeSnapshot): void

Returns __type(snapshot: ThemeRuntimeSnapshot): void


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

Returns ThemeRuntime<T>


useThemeSchedule<T extends ThemeDefinition<string>>(): { disable: __type(): void; enable: __type(): void; set: __type(options: ThemeScheduleSetOptions): void; active: void; darkTheme: void; enabled: void; lightTheme: void; nextActivation: void; nextDeactivation: void; nextTransition: void; status: void; sunrise: void; sunset: void } | null

Reactive access to the runtime's sunrise/sunset scheduling controller. Returns null when the provider was created without the scheduled option. Reads of enabled/active/status/sunrise/sunset/nextTransition track the underlying state reactively.

tsx
const schedule = useThemeSchedule();
schedule?.enable();
schedule?.disable();

Returns { disable: __type(): void; enable: __type(): void; set: __type(options: ThemeScheduleSetOptions): void; active: void; darkTheme: void; enabled: void; lightTheme: void; nextActivation: void; nextDeactivation: void; nextTransition: void; status: void; sunrise: void; sunset: void } | null


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

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


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

Returns Accessor<ThemeTokens | undefined>


useThemeValue<T extends ThemeDefinition<string>>(): Accessor<T>

Returns Accessor<T>


Interfaces

ThemeInspectorProps

MemberTypeDescription
bottom (optional)numberDistance from the bottom of the viewport, in px. Default 104.
class (optional)stringForwarded to the underlying <theme-kit-inspector> element.
right (optional)numberDistance from the right edge of the viewport, in px. Default 32.
size (optional)numberToggle button size, in px. Default 40.
style (optional)string
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`
children (optional)Element
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

ThemeScopeProps

MemberTypeDescription
children (optional)Element
className (optional)string
family (optional)stringTheme family for the scoped subtree. When mode is omitted the scope
follows the provider's current mode (light/dark/system).
mode (optional)ThemeModeMode for a family-based scope. Optional — defaults to the provider's
current mode so family="plum" flips light/dark with the page.
theme (optional)stringExact theme name, family name, or a { family, mode }-style object.
When family/mode are also passed, theme wins (it's the explicit
selection). Omit to follow the global selection inside a new boundary.
themes (optional)readonly ThemeDefinition<string>[]Local theme definitions for genuinely isolated components. Resolved FIRST
(they shadow same-named parent themes), then the provider's registry
falls back — no second runtime is created.
transition (optional)`booleanThemeTransitionOptions`
<ThemeProvider/> transition, false disables it, true inherits, and
an object is merged over the provider's config (local keys win).

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.
children (optional)Element
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.
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

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