Skip to content
Source
Sign inSign up
TanStack/devtools
Open History to see the last commit

basic-setup.md

53 lines1.8 KB

1---
2title: Basic setup
3id: basic-setup
4---
5​
6TanStack Devtools provides you with an easy-to-use and modular client that allows you to compose multiple devtools into one easy-to-use panel.
7​
8## Setup
9​
10Install the [TanStack Devtools](https://www.npmjs.com/package/@tanstack/svelte-devtools) library. This will install the devtools core as well as provide you with the Svelte-specific adapter.
11​
12```bash
13npm i @tanstack/svelte-devtools
14```
15​
16Next, in the root of your application, import the `TanStackDevtools` component from `@tanstack/svelte-devtools` and add it to your template.
17​
18```svelte
19<script lang="ts">
20 import { TanStackDevtools } from '@tanstack/svelte-devtools'
21</script>
22​
23<main>
24 <!-- Your app content -->
25</main>
26<TanStackDevtools />
27```
28​
29Import the desired devtools and provide them to the `TanStackDevtools` component via the `plugins` prop along with a label for the menu.
30​
31```svelte
32<script lang="ts">
33 import { TanStackDevtools } from '@tanstack/svelte-devtools'
34 import type { TanStackDevtoolsSveltePlugin } from '@tanstack/svelte-devtools'
35 import { SvelteQueryDevtoolsPanel } from '@tanstack/svelte-query-devtools'
36​
37 const plugins: TanStackDevtoolsSveltePlugin[] = [
38 {
39 name: 'Svelte Query',
40 component: SvelteQueryDevtoolsPanel,
41 },
42 ]
43</script>
44​
45<main>
46 <!-- Your app content -->
47</main>
48<TanStackDevtools {plugins} />
49```
50​
51> Note: The Svelte adapter uses `component` (a Svelte component reference) instead of `render` (a JSX element) in plugin definitions. Additional props can be provided via the `props` field and are passed to the component on mount.
52​
53Finally, add any additional configuration you desire to the `TanStackDevtools` component. More information can be found under the [TanStack Devtools Configuration](../../configuration) section.