Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6Wave your hands in the air and shout hooray because Vue Query comes with dedicated devtools! π₯³
7β
8When you begin your Vue Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of Vue Query and will likely save you hours of debugging if you find yourself in a pinch!
9β
10The only thing you need to do is to install the official **[Vue Devtools](https://devtools.vuejs.org/guide/installation.html)**.
11β
12Vue Query will seamlessly integrate with the official devtools, adding custom inspector and timeline events.
13Devtool code will be treeshaken from production bundles by default.
14β
15## Component based Devtools (Vue 3)
16β
17You can embeed devtools component into your page by using dedicated package.
18Component based devtools are using the same framework-agnostic implementation, have more features and are updated more frequently.
19β
20The devtools component is a separate package that you need to install:
21β
22```bash
23$ npm i @tanstack/vue-query-devtools
24# or
25$ pnpm add @tanstack/vue-query-devtools
26# or
27$ yarn add @tanstack/vue-query-devtools
28```
29β
30By default, Vue Query Devtools are only included in bundles when `process.env.NODE_ENV === 'development'`, so you don't need to worry about excluding them during a production build.
31β
32Devtools will be mounted 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.
33β
34Place the following code as high in your Vue app as you can. The closer it is to the root of the page, the better it will work!
35β
36```vue
37<script setup>
38import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
39</script>
40β
41<template>
42 <h1>The app!</h1>
43 <VueQueryDevtools />
44</template>
45```
46β
47### Options
48β
49- `initialIsOpen: Boolean`
50 - Set this `true` if you want the dev tools to default to being open
51- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
52 - Defaults to `bottom-left`
53 - The position of the React Query logo to open and close the devtools panel
54- `position?: "top" | "bottom" | "left" | "right"`
55 - Defaults to `bottom`
56 - The position of the React Query devtools panel
57- `client?: QueryClient`,
58 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
59- `errorTypes?: { name: string; initializer: (query: Query) => TError}`
60 - 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.
61- `styleNonce?: string`
62 - 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.