Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6Wave your hands in the air and shout hooray because Solid Query comes with dedicated devtools! π₯³
7β
8When you begin your Solid Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of Solid Query and will likely save you hours of debugging if you find yourself in a pinch!
9β
10## Install and Import the Devtools
11β
12The devtools are a separate package that you need to install:
13β
14```bash
15npm i @tanstack/solid-query-devtools
16```
17β
18or
19β
20```bash
21pnpm add @tanstack/solid-query-devtools
22```
23β
24or
25β
26```bash
27yarn add @tanstack/solid-query-devtools
28```
29β
30or
31β
32```bash
33bun add @tanstack/solid-query-devtools
34```
35β
36You can import the devtools like this:
37β
38```tsx
39import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
40```
41β
42By default, Solid Query Devtools are only included in bundles when `isServer === true` ([`isServer`](https://github.com/solidjs/solid/blob/a72d393a07b22f9b7496e5eb93712188ccce0d28/packages/solid/web/src/index.ts#L37) comes from the `solid-js/web` package), so you don't need to worry about excluding them during a production build.
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 Solid app as you can. The closer it is to the root of the page, the better it will work!
49β
50```tsx
51import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
52β
53function App() {
54 return (
55 <QueryClientProvider client={queryClient}>
56 {/* The rest of your application */}
57 <SolidQueryDevtools initialIsOpen={false} />
58 </QueryClientProvider>
59 )
60}
61```
62β
63### Options
64β
65- `initialIsOpen: Boolean`
66 - Set this `true` if you want the dev tools to default to being open
67- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
68 - Defaults to `bottom-right`
69 - The position of the Solid Query logo to open and close the devtools panel
70- `position?: "top" | "bottom" | "left" | "right"`
71 - Defaults to `bottom`
72 - The position of the Solid 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.