Open History to see the last commit
1---
2title: Configuration
3id: configuration
4---
5β
6Both TanStack `DevTools` and `EventClient` can be configured.
7β
8> [!IMPORTANT]
9> All configuration is optional unless marked (required)
10β
11## Devtools Component Configuration
12β
13The `Devtools` component has two configuration props, regardless of Frameworks these are the same.
14β
15- `config` - Configuration for the devtool panel and interaction with it.
16- `eventBusConfig` - Configuration for the event bus.
17β
18The `config` object is mainly focused around user interaction with the devtools panel and accepts the following properties:
19β
20- `defaultOpen` - If the devtools are open by default
21β
22```ts
23{ defaultOpen: boolean }
24```
25β
26- `hideUntilHover` - Hides the TanStack devtools trigger until hovered
27β
28```ts
29{ hideUntilHover: boolean }
30```
31β
32- `position` - The position of the TanStack devtools trigger
33β
34```ts
35{ position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle-left' | 'middle-right' }
36```
37β
38- `panelLocation` - The location of the devtools panel
39β
40```ts
41{ panelLocation: 'top' | 'bottom' }
42```
43β
44- `openHotkey` - The hotkey set to open the devtools
45β
46```ts
47type ModifierKey = 'Alt' | 'Control' | 'Meta' | 'Shift' | 'CtrlOrMeta';
48type KeyboardKey = ModifierKey | (string & {});
49β
50{ openHotkey: Array<KeyboardKey> }
51```
52β
53- `inspectHotkey` - The hotkey set to open the source inspector
54β
55```ts
56type ModifierKey = 'Alt' | 'Control' | 'Meta' | 'Shift' | 'CtrlOrMeta';
57type KeyboardKey = ModifierKey | (string & {});
58β
59{ inspectHotkey: Array<KeyboardKey> }
60```
61β
62- `requireUrlFlag` - Requires a flag present in the url to enable devtools
63β
64```ts
65{ requireUrlFlag: boolean }
66```
67β
68- `triggerImage` - The image used for the dev tools trigger
69β
70```ts
71{ triggerImage: string }
72```
73β
74- `urlFlag` - The required flag that must be present in the url to enable devtools.
75β
76```ts
77{ urlFlag: string }
78```
79β
80The `eventBusConfig` is configuration for the back bone of the devtools, the `EventClient`, and accepts the following properties:
81β
82- `debug` - Enables debug mode for the EventBus
83β
84```ts
85{ debug: boolean }
86```
87β
88- `connectToServerBus` - Optional flag to indicate if the devtools server event bus is available to connect to
89β
90```ts
91{ connectToServerBus: boolean }
92```
93β
94- `port` - The port at which the client connects to the devtools server event bus
95β
96```ts
97{ port: number }
98```
99β
100Put together here is an example in react:
101β
102```tsx
103import { StrictMode } from 'react'
104import { createRoot } from 'react-dom/client'
105import { FormDevtools } from '@tanstack/react-form'
106β
107import { TanStackDevtools } from '@tanstack/react-devtools'
108β
109import App from './App'
110β
111createRoot(document.getElementById('root')!).render(
112 <StrictMode>
113 <App />
114β
115 <TanStackDevtools
116 config={{ hideUntilHover: true }}
117 eventBusConfig={{ debug: true }}
118 plugins={[
119 {
120 name: 'TanStack Form',
121 render: <FormDevtools />,
122 defaultOpen: true,
123 },
124 ]}
125 />
126 </StrictMode>,
127)
128β
129```
130β
131## EventClient Configuration
132β
133Configuration for the `EventClient` is as follows
134β
135- `pluginId` (required) - The plugin identifier used by the event bus to direct events to listeners
136β
137```ts
138{ pluginId: string }
139```
140β
141- `debug` - Enables debug mode for the EventClient
142β
143```ts
144{ debug: boolean }
145```
146β
147Put together the `EventClient` configuration looks like:
148β
149```tsx
150import { EventClient } from '@tanstack/devtools-event-client'
151β
152type EventMap = {
153 'custom-state': { state: string }
154}
155β
156class customEventClient extends EventClient<EventMap> {
157 constructor() {
158 super({
159 debug: true,
160 pluginId: 'custom-devtools',
161 })
162 }
163}
164```
165β
166More information about EventClient configuration can be found in our [custom-plugins example](https://tanstack.com/devtools/latest/docs/framework/react/examples/custom-devtools)