Guide

Get Started

Start using Mode Watcher in your SvelteKit app.

Install the package

You can install the project via npm or pnpm.

	pnpm add mode-watcher	

Add the ModeWatcher component

Add the <ModeWatcher /> component to your root +layout.svelte file.

	<script lang="ts">
	import { ModeWatcher } from "mode-watcher";
</script>
 
<ModeWatcher />
<slot />	

That's it!

You're ready to use Mode Watcher in your Svelte app.

Here's an example of how to use the toggleMode function to toggle the mode:

	<script lang="ts">
	import { toggleMode } from "mode-watcher";
</script>
 
<button on:click={toggleMode}>Toggle Mode</button>	

For additional information and configuration, please refer to the API reference.

MIT

© 2026 Svecosystem Team