devtools/docs/framework/angular/adapter.md
Riccardo Perra ad26f6182f
feat(angular): angular adapter and utils (#368)
* feat(angular-devtools): create angular adapter package

Add the @tanstack/angular-devtools package with:
- TanStackDevtoolsComponent: standalone Angular component that wraps TanStackDevtoolsCore
- Plugin system supporting Angular components rendered into devtools containers
- Type definitions for Angular-specific plugin and init configuration
- Build config using @analogjs/vite-plugin-angular for AOT compilation

* fix(angular-devtools): add reactivity for input changes, remove unused RenderArray

* feat(devtools-utils): add angular support

* fix: resolve angular build issues

- Remove @analogjs/vite-plugin-angular from build (produces empty chunks
  for library builds). Use plain esbuild via Vite instead - Angular AOT
  compilation happens at consumer's build time.
- Upgrade Angular dev deps from ^19 to ^20 for TypeScript 5.9 compat.
- Remove @angular/build dep (only needed by analogjs plugin).
- Add @tanstack/angular-devtools workspace override to root.

* ci: apply automated fixes

* fix: resolve lint, knip, and sherif issues

- Fix array-type ESLint rule in angular-devtools
- Fix import/consistent-type-specifier-style in devtools-utils angular
- Sort peerDependencies alphabetically (sherif)
- Remove unused devDependencies flagged by knip
- Remove angularCompilerOptions from tsconfig (not using ngc)

* feat: add Angular support with setup, adapter, and custom plugin documentation

* feat(angular): angular adapter add utils and some examples, fix build

* ci: apply automated fixes

* feat: Add angular adapter and devtools-utils/angular

* remove afterNextRender in devtools-utils

Since angular-devtools already run the code within afterNextRender in browser env, we don't like to wrap the panel returned from utils

* fix examples

* fix angular devtools wrong pnpm link

* feat(angular-devtools): add with-devtools provider

* docs(angular-devtools): update docs

* ci: apply automated fixes

* chore(angular-devtools): fix examples dependencies and knip issues

* feat(angular-devtools): rename withDevtools to provideTanStackDevtools

* Add a11y plugin for angular

* chore(deps): update @tanstack/devtools and related packages

* ci: apply automated fixes

---------

Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-28 20:17:46 +02:00

3.2 KiB

title id
TanStack Devtools Angular Adapter adapter

The 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.

Installation

npm install @tanstack/angular-devtools

Component Inputs

The TanStackDevtools (selector: tanstack-devtools) accepts the following signal-based inputs, defined by the TanStackDevtoolsAngularInit interface:

Input Type Description
plugins TanStackDevtoolsAngularPlugin[] Array of plugins to render inside the devtools panel.
config Partial<TanStackDevtoolsConfig> Configuration for the devtools shell. Sets the initial state on first load; afterwards settings are persisted in local storage.
eventBusConfig ClientEventBusConfig Configuration for the TanStack Devtools client event bus.

Plugin Type

Each plugin in the plugins array must conform to the TanStackDevtoolsAngularPlugin type:

type TanStackDevtoolsAngularPlugin = {
  id?: string
  render: TanStackDevtoolsAngularPluginRender
  name: string | Type<any>
  inputs?: Record<string, any>
  defaultOpen?: boolean
}
Field Type Description
id string (optional) Unique identifier for the plugin.
render Type<any> The Angular component class to render as the plugin panel content.
name string | Type<any> Display name for the tab title. Can be a plain string or an Angular component class for custom rendering.
inputs Record<string, any> (optional) Additional inputs passed to the plugin component via setInput().
defaultOpen boolean (optional) Whether this plugin tab should be open by default.

Key Differences from Other Frameworks

The 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.

import { Component } from '@angular/core'
import { TanStackDevtools } from '@tanstack/angular-devtools'
import { AngularQueryDevtoolsPanel } from '@tanstack/angular-query-devtools'

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [TanStackDevtools],
  template: `
    <tanstack-devtools [plugins]="plugins" />
  `,
})
export class App {
  plugins = [
    {
      name: 'Angular Query',
      render: AngularQueryDevtoolsPanel,
      inputs: { style: 'height: 100%' },
    },
  ]
}

Exports

The @tanstack/angular-devtools package exports:

  • TanStackDevtools -- The main Angular standalone component that renders the devtools panel.
  • TanStackDevtoolsAngularPlugin (type) -- The type for plugin definitions.
  • TanStackDevtoolsAngularInit (type) -- The inputs interface for the TanStackDevtoolsComponent.

The package depends on @tanstack/devtools (the core package), which provides TanStackDevtoolsCore, TanStackDevtoolsConfig, ClientEventBusConfig, and other core utilities.