Open History to see the last commit
1---
2title: TanStack Devtools Angular Adapter
3id: adapter
4---
5β
6The Angular adapter wraps `TanStackDevtoolsCore` in an Angular standalone component, using Angular's `createComponent` and `ApplicationRef.attachView` to dynamically render plugins into the correct DOM containers managed by the devtools shell.
7β
8## Installation
9β
10```sh
11npm install @tanstack/angular-devtools
12```
13β
14## Component Inputs
15β
16The `TanStackDevtools` (selector: `tanstack-devtools`) accepts the following signal-based inputs, defined by the `TanStackDevtoolsAngularInit` interface:
17β
18| Input | Type | Description |
19| --- | --- | --- |
20| `plugins` | `TanStackDevtoolsAngularPlugin[]` | Array of plugins to render inside the devtools panel. |
21| `config` | `Partial<TanStackDevtoolsConfig>` | Configuration for the devtools shell. Sets the initial state on first load; afterwards settings are persisted in local storage. |
22| `eventBusConfig` | `ClientEventBusConfig` | Configuration for the TanStack Devtools client event bus. |
23β
24## Plugin Type
25β
26Each plugin in the `plugins` array must conform to the `TanStackDevtoolsAngularPlugin` type:
27β
28```ts
29type TanStackDevtoolsAngularPlugin = {
30 id?: string
31 render: TanStackDevtoolsAngularPluginRender
32 name: string | Type<any>
33 inputs?: Record<string, any>
34 defaultOpen?: boolean
35}
36```
37β
38| Field | Type | Description |
39|---------------| --- | --- |
40| `id` | `string` (optional) | Unique identifier for the plugin. |
41| `render` | `Type<any>` | The Angular component class to render as the plugin panel content. |
42| `name` | `string \| Type<any>` | Display name for the tab title. Can be a plain string or an Angular component class for custom rendering. |
43| `inputs` | `Record<string, any>` (optional) | Additional inputs passed to the plugin component via `setInput()`. |
44| `defaultOpen` | `boolean` (optional) | Whether this plugin tab should be open by default. |
45β
46## Key Differences from Other Frameworks
47β
48The Angular adapter uses `component` (an Angular component class reference) instead of `render` (a JSX element) in plugin definitions. Inputs are provided through the `inputs` field and bound to the component with `setInput()`, rather than being embedded directly in a JSX expression or passed via `v-bind`.
49β
50```typescript
51import { Component } from '@angular/core'
52import { TanStackDevtools } from '@tanstack/angular-devtools'
53import { AngularQueryDevtoolsPanel } from '@tanstack/angular-query-devtools'
54β
55@Component({
56 selector: 'app-root',
57 standalone: true,
58 imports: [TanStackDevtools],
59 template: `
60 <tanstack-devtools [plugins]="plugins" />
61 `,
62})
63export class App {
64 plugins = [
65 {
66 name: 'Angular Query',
67 render: AngularQueryDevtoolsPanel,
68 inputs: { style: 'height: 100%' },
69 },
70 ]
71}
72```
73β
74## Exports
75β
76The `@tanstack/angular-devtools` package exports:
77β
78- **`TanStackDevtools`** -- The main Angular standalone component that renders the devtools panel.
79- **`TanStackDevtoolsAngularPlugin`** (type) -- The type for plugin definitions.
80- **`TanStackDevtoolsAngularInit`** (type) -- The inputs interface for the `TanStackDevtoolsComponent`.
81β
82The package depends on `@tanstack/devtools` (the core package), which provides `TanStackDevtoolsCore`, `TanStackDevtoolsConfig`, `ClientEventBusConfig`, and other core utilities.