API reference

usePreferencesStore

Theme and appearance preferences, stored in cookies.

stores/preferences.ts

usePreferencesStore()

Returns themeName, themeMode, isDark, appearance, isDefaultAppearance and the setters setTheme, toggleTheme, setThemeMode, useSystemTheme, setAppearance, resetOption and resetAppearance.

stores/preferences.ts
const usePreferencesStore: SetupStoreDefinition<"preferences", { themeName: any; themeMode: any; isDark: any; appearance: any; isDefaultAppearance: any; hasExplicitTheme: any; setTheme: (name: ThemeName) =>…

DEFAULT_APPEARANCE

The defaults of every appearance option.

config/appearance.config.ts
const DEFAULT_APPEARANCE: AppearancePreferences

APPEARANCE_OPTIONS

The allowed values of every option.

config/appearance.config.ts
const APPEARANCE_OPTIONS: { readonly primary: ("brand" | "sage" | "blue" | "violet" | "rose" | "amber" | "graphite")[]; readonly menu: readonly ["light", "semi-dark"]; readonly layout: readonly ["vertical"…

normalizeAppearance()

Validates a cookie value against the options.

stores/preferences.ts
normalizeAppearance(value: unknown): AppearancePreferences
ReturnsprimarymenulayoutcontentWidthdirectiondensity

The theme cookie.

stores/preferences.ts
const THEME_COOKIE_KEY: "app-theme"

The cookie with the resolved system theme.

stores/preferences.ts
const THEME_RESOLVED_COOKIE_KEY: "app-theme-resolved"

The appearance cookie.

stores/preferences.ts
const APPEARANCE_COOKIE_KEY: "app-appearance"
© 2026 melsami UI.
Developer documentation for melsami UI.