Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6## Install and Import the Devtools
7β
8The devtools are a separate package that you need to install:
9β
10```bash
11npm i @tanstack/angular-query-devtools-experimental
12```
13β
14or
15β
16```bash
17pnpm add @tanstack/angular-query-devtools-experimental
18```
19β
20or
21β
22```bash
23yarn add @tanstack/angular-query-devtools-experimental
24```
25β
26or
27β
28```bash
29bun add @tanstack/angular-query-devtools-experimental
30```
31β
32You can import the devtools like this:
33β
34```ts
35import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
36```
37β
38## Floating Mode
39β
40Floating 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.
41β
42Place the following code as high in your Angular app as you can. The closer it is to the root of the page, the better it will work!
43β
44```angular-ts
45import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
46import { Component } from '@angular/core';
47β
48@Component({
49 selector: 'app-root',
50 standalone: true,
51 imports: [AngularQueryDevtools],
52 template: `
53 <angular-query-devtools initialIsOpen />
54 `,
55})
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 Angular Query devtools panel
69- `client?: QueryClient`,
70 - Use this to use a custom QueryClient. Otherwise, the QueryClient provided through provideAngularQuery() will be injected.
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.