Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6> For Google Chrome users: A third-party Chrome extension is available for debugging TanStack Query directly in Chrome DevTools. This provides the same functionality as the framework-specific devtools packages. Check it out here: [TanStack Query DevTools](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai)
7β
8## Install and Import the Devtools
9β
10The devtools are a separate package that you need to install:
11β
12```bash
13npm i @tanstack/svelte-query-devtools
14```
15β
16or
17β
18```bash
19pnpm add @tanstack/svelte-query-devtools
20```
21β
22or
23β
24```bash
25yarn add @tanstack/svelte-query-devtools
26```
27β
28or
29β
30```bash
31bun add @tanstack/svelte-query-devtools
32```
33β
34You can import the devtools like this:
35β
36```ts
37import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
38```
39β
40## Floating Mode
41β
42Floating 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.
43β
44Place 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!
45β
46```ts
47<script>
48 import { QueryClientProvider } from '@tanstack/svelte-query'
49 import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
50</script>
51β
52<QueryClientProvider client={queryClient}>
53 {/* The rest of your application */}
54 <SvelteQueryDevtools />
55</QueryClientProvider>
56```
57β
58### Options
59β
60- `initialIsOpen: Boolean`
61 - Set this `true` if you want the dev tools to default to being open
62- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "relative"`
63 - Defaults to `bottom-right`
64 - The position of the TanStack logo to open and close the devtools panel
65 - If `relative`, the button is placed in the location that you render the devtools.
66- `position?: "top" | "bottom" | "left" | "right"`
67 - Defaults to `bottom`
68 - The position of the Svelte Query devtools panel
69- `client?: QueryClient`,
70 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
71- `errorTypes?: { name: string; initializer: (query: Query) => TError}`
72 - 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.
73- `styleNonce?: string`
74 - 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.
75- `shadowDOMTarget?: ShadowRoot`
76 - Default behavior will apply the devtool's styles to the head tag within the DOM.
77 - 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.