Both TanStack DevTools and EventClient can be configured.
Important
all configuration is optional unless marked (required)
The Devtools component has two configuration props, regardless of Frameworks these are the same.
The config object is mainly focused around user interaction with the devtools panel and accepts the following properties:
{ defaultOpen: boolean }
{ defaultOpen: boolean }
{ hideUntilHover: boolean }
{ hideUntilHover: boolean }
{ position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle-left' | 'middle-right' }
{ position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle-left' | 'middle-right' }
{ panelLocation: 'top' | 'bottom' }
{ panelLocation: 'top' | 'bottom' }
type ModifierKey = 'Alt' | 'Control' | 'Meta' | 'Shift';
type KeyboardKey = ModifierKey | (string & {});
{ openHotkey: Array<KeyboardKey> }
type ModifierKey = 'Alt' | 'Control' | 'Meta' | 'Shift';
type KeyboardKey = ModifierKey | (string & {});
{ openHotkey: Array<KeyboardKey> }
{ requireUrlFlag: boolean }
{ requireUrlFlag: boolean }
{ urlFlag: string }
{ urlFlag: string }
The eventBusConfig is configuration for the back bone of the devtools, the ``, and accepts the following properties:
{ debug: boolean }
{ debug: boolean }
{ connectToServerBus: boolean }
{ connectToServerBus: boolean }
{ port: number }
{ port: number }
Put together here is an example in react:
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { FormDevtools } from '@tanstack/react-form'
import { TanStackDevtools } from '@tanstack/react-devtools'
import App from './App'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
<TanStackDevtools
config={{ hideUntilHover: true, }}
eventBusConfig={{ debug: true }}
plugins={[
{
name: 'TanStack Form',
render: <FormDevtools />,
},
]}
/>
</StrictMode>,
)
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { FormDevtools } from '@tanstack/react-form'
import { TanStackDevtools } from '@tanstack/react-devtools'
import App from './App'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
<TanStackDevtools
config={{ hideUntilHover: true, }}
eventBusConfig={{ debug: true }}
plugins={[
{
name: 'TanStack Form',
render: <FormDevtools />,
},
]}
/>
</StrictMode>,
)
Configuration for the EventClient is as follows
{pluginId: string}
{pluginId: string}
{debug: boolean}
{debug: boolean}
Put together the EventClient configuration looks like:
import { EventClient } from '@tanstack/devtools-event-client'
type EventMap = {
'custom-devtools:custom-state': { state: string }
}
class customEventClient extends EventClient<EventMap> {
constructor() {
super({
debug: true,
pluginId: 'custom-devtools',
})
}
}
import { EventClient } from '@tanstack/devtools-event-client'
type EventMap = {
'custom-devtools:custom-state': { state: string }
}
class customEventClient extends EventClient<EventMap> {
constructor() {
super({
debug: true,
pluginId: 'custom-devtools',
})
}
}
More information about EventClient configuration can be found in our custom-plugins example
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.