Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6> For Chrome, Firefox, and Edge users: Third-party browser extensions are available for debugging TanStack Query directly in browser DevTools. These provide the same functionality as the framework-specific devtools packages:
7>
8> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai">Devtools for Chrome</a>
9> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/">Devtools for Firefox</a>
10> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj">Devtools for Edge</a>
11β
12## Install and Import the Devtools
13β
14The devtools are a separate package that you need to install:
15β
16```bash
17npm i @tanstack/svelte-query-devtools
18```
19β
20or
21β
22```bash
23pnpm add @tanstack/svelte-query-devtools
24```
25β
26or
27β
28```bash
29yarn add @tanstack/svelte-query-devtools
30```
31β
32or
33β
34```bash
35bun add @tanstack/svelte-query-devtools
36```
37β
38You can import the devtools like this:
39β
40```ts
41import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
42```
43β
44## Floating Mode
45β
46Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads.
47β
48Place the following code as high in your Svelte app as you can. The closer it is to the root of the page, the better it will work!
49β
50```ts
51<script>
52 import { QueryClientProvider } from '@tanstack/svelte-query'
53 import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
54</script>
55β
56<QueryClientProvider client={queryClient}>
57 {/* The rest of your application */}
58 <SvelteQueryDevtools />
59</QueryClientProvider>
60```
61β
62### Options
63β
64- `initialIsOpen: boolean`
65 - Set this `true` if you want the dev tools to default to being open
66- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "relative"`
67 - Defaults to `bottom-right`
68 - The position of the TanStack logo to open and close the devtools panel
69 - If `relative`, the button is placed in the location that you render the devtools.
70- `position?: "top" | "bottom" | "left" | "right"`
71 - Defaults to `bottom`
72 - The position of the Svelte Query devtools panel
73- `client?: QueryClient`,
74 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
75- `errorTypes?: { name: string; initializer: (query: Query) => TError}[]`
76 - Use this to predefine some errors that can be triggered on your queries. Initializer will be called (with the specific query) when that error is toggled on from the UI. It must return an Error.
77- `styleNonce?: string`
78 - Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
79- `shadowDOMTarget?: ShadowRoot`
80 - Default behavior will apply the devtool's styles to the head tag within the DOM.
81 - Use this to pass a shadow DOM target to the devtools so that the styles will be applied within the shadow DOM instead of within the head tag in the light DOM.