Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

devtools.md

55 lines1.7 KB

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
11$ npm i @tanstack/angular-query-devtools-experimental
12# or
13$ pnpm add @tanstack/angular-query-devtools-experimental
14# or
15$ yarn add @tanstack/angular-query-devtools-experimental
16```
17​
18You can import the devtools like this:
19​
20```ts
21import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
22```
23​
24## Floating Mode
25​
26Floating 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.
27​
28Place 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!
29​
30```ts
31import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
32import { Component } from '@angular/core';
33​
34@Component({
35 selector: 'app-root',
36 standalone: true,
37 imports: [AngularQueryDevtools],
38 template: `
39 <angular-query-devtools initialIsOpen />
40 `,
41})
42```
43​
44### Options
45​
46- `initialIsOpen: Boolean`
47 - Set this `true` if you want the dev tools to default to being open
48- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
49 - Defaults to `bottom-left`
50 - The position of the TanStack logo to open and close the devtools panel
51- `position?: "top" | "bottom" | "left" | "right"`
52 - Defaults to `bottom`
53 - The position of the Angular Query devtools panel
54- `client?: QueryClient`,
55 - Use this to use a custom QueryClient. Otherwise, the QueryClient provided through provideAngularQuery() will be injected.