Skip to content

API Reference

Exports

ts
// Core
export { VueMultipleThemes } from 'vue-multiple-themes';
export { VueMultipleThemesPlugin } from 'vue-multiple-themes';
export { useTheme } from 'vue-multiple-themes';

// Preset themes
export { PRESET_THEMES } from 'vue-multiple-themes';
export {
  lightTheme,
  darkTheme,
  sepiaTheme,
  oceanTheme,
  forestTheme,
  sunsetTheme,
  winterTheme,
};

// Utilities (tree-shakeable)
export { buildCssVars, injectStyles, removeStyles } from 'vue-multiple-themes';
export { LUCIDE_ICONS, getIcon, iconToSvg } from 'vue-multiple-themes';

// Tailwind plugin (separate entry point)
export {
  vmtTailwindPlugin,
  createVmtPlugin,
} from 'vue-multiple-themes/tailwind';

// Types
export type {
  ThemeColors,
  ThemeDefinition,
  ThemeStrategy,
  ThemeTarget,
  ThemeOptions,
  UseThemeReturn,
  VueMultipleThemesProps,
  TailwindPluginOptions,
} from 'vue-multiple-themes';

ThemeOptions

OptionTypeDefaultDescription
themesThemeDefinition[](required)All available themes
defaultThemestringfirst themeName to activate on first render
strategy'attribute' | 'class' | 'both''attribute'How to stamp the theme on the DOM
attributestring'data-theme'Attribute name for 'attribute' strategy
classPrefixstring'theme-'Class prefix for 'class' strategy
targetstring'html'DOM element to receive the attribute/class
injectCssVarsbooleantrueAuto-inject CSS vars into <head>
cssVarPrefixstring'--vmt-'Prefix for generated CSS variables
storage'localStorage' | 'sessionStorage' | 'none''localStorage'Persistence layer
storageKeystring'vmt-theme'Storage key
respectSystemPreferencebooleanfalseAuto-select dark/light from OS
onChange(theme: ThemeDefinition) => voidCallback on theme change

ThemeDefinition

FieldTypeRequiredDescription
namestringUnique slug (data-theme value)
labelstringHuman-readable display name
iconstringLucide icon name for built-in toggle
colorsThemeColorsColour token map
extraClassesstring[]Extra classes added to target element

<VueMultipleThemes> Props

PropTypeDefaultDescription
themesThemeDefinition[]built-in 3Theme list
defaultThemestringInitial theme
strategyThemeStrategy'attribute'DOM strategy
attributestring'data-theme'Attribute name
classPrefixstring'theme-'Class prefix
targetstring'html'DOM target
injectCssVarsbooleantrueInject CSS
cssVarPrefixstring'--vmt-'CSS var prefix
storagestring'localStorage'Storage type
storageKeystring'vmt-theme'Storage key
respectSystemPreferencebooleanfalseOS preference
showTogglebooleantrueShow toggle button
showLabelbooleanfalseShow label alongside icon
iconSizenumber20Icon size in px
extraClassstring''CSS class on root wrapper

Emits

EventPayloadDescription
changeThemeDefinitionEmitted after theme changes

Slots

SlotPropsDescription
default{ theme, themes, setTheme, nextTheme, prevTheme, toggleTheme, isDark }Replace the toggle button
picker{ themes, current, setTheme }Add a full theme picker

Released under the MIT License.