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

tanstackdevtoolsplugin.md

135 lines2.6 KB

1---
2id: TanStackDevtoolsPlugin
3title: TanStackDevtoolsPlugin
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8# Interface: TanStackDevtoolsPlugin
9​
10Defined in: [devtools/src/context/devtools-context.tsx:15](https://github.com/TanStack/devtools/blob/main/packages/devtools/src/context/devtools-context.tsx#L15)
11​
12## Properties
13​
14### defaultOpen?
15​
16```ts
17optional defaultOpen: boolean;
18```
19​
20Defined in: [devtools/src/context/devtools-context.tsx:58](https://github.com/TanStack/devtools/blob/main/packages/devtools/src/context/devtools-context.tsx#L58)
21​
22Whether the plugin should be open by default when there are no active plugins.
23If true, this plugin will be added to activePlugins on initial load when activePlugins is empty.
24​
25#### Default
26​
27```ts
28false
29```
30​
31***
32​
33### destroy()?
34​
35```ts
36optional destroy: (pluginId) => void;
37```
38​
39Defined in: [devtools/src/context/devtools-context.tsx:77](https://github.com/TanStack/devtools/blob/main/packages/devtools/src/context/devtools-context.tsx#L77)
40​
41#### Parameters
42​
43##### pluginId
44​
45`string`
46​
47#### Returns
48​
49`void`
50​
51***
52​
53### id?
54​
55```ts
56optional id: string;
57```
58​
59Defined in: [devtools/src/context/devtools-context.tsx:52](https://github.com/TanStack/devtools/blob/main/packages/devtools/src/context/devtools-context.tsx#L52)
60​
61Unique identifier for the plugin.
62If not provided, it will be generated based on the name.
63​
64***
65​
66### name
67​
68```ts
69name: string | (el, theme) => void;
70```
71​
72Defined in: [devtools/src/context/devtools-context.tsx:42](https://github.com/TanStack/devtools/blob/main/packages/devtools/src/context/devtools-context.tsx#L42)
73​
74Name to be displayed in the devtools UI.
75If a string, it will be used as the plugin name.
76If a function, it will be called with the mount element.
77​
78Example:
79```ts
80 {
81 // If a string, it will be used as the plugin name
82 name: "Your Plugin",
83 render: () => {}
84 }
85```
86or
87​
88```ts
89 {
90 // If a function, it will be called with the mount element
91 name: (el) => {
92 el.innerText = "Your Plugin Name"
93 // Your name logic here
94 },
95 render: () => {}
96 }
97```
98​
99***
100​
101### render()
102​
103```ts
104render: (el, theme) => void;
105```
106​
107Defined in: [devtools/src/context/devtools-context.tsx:72](https://github.com/TanStack/devtools/blob/main/packages/devtools/src/context/devtools-context.tsx#L72)
108​
109Render the plugin UI by using the provided element. This function will be called
110when the plugin tab is clicked and expected to be mounted.
111​
112#### Parameters
113​
114##### el
115​
116`HTMLDivElement`
117​
118The mount element for the plugin.
119​
120##### theme
121​
122`"light"` | `"dark"`
123​
124#### Returns
125​
126`void`
127​
128void
129​
130Example:
131```ts
132 render: (el) => {
133 el.innerHTML = "<h1>Your Plugin</h1>"
134 }
135```