### Project Dependencies for A11y Devtools Example
Source: https://tanstack.com/devtools/latest/docs/framework/react/examples/a11y-devtools
Lists the necessary dependencies for running the A11y Devtools example, including React, Devtools, and Vite build tools. Ensure these are installed before running the example.
```json
{
"name": "@tanstack/react-devtools-a11y-example",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --port=3002",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
},
"dependencies": {
"@tanstack/devtools-a11y": "^0.1.3",
"@tanstack/react-devtools": "^0.10.5",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@tanstack/devtools-vite": "0.7.0",
"@types/react": "^19.2.0",
"@types/react-dom": "^19.2.0",
"@vitejs/plugin-react": "^6.0.1"
}
}
```
--------------------------------
### Install Devtools Event Client
Source: https://tanstack.com/devtools/latest/docs/building-custom-plugins.md
Install the necessary package for the EventClient.
```bash
npm i @tanstack/devtools-event-client
```
--------------------------------
### Install Vanilla JS Devtools
Source: https://tanstack.com/devtools/latest/docs/installation.md
Install the core Devtools package for use with any framework or without a framework.
```bash
npm install -D @tanstack/devtools
```
--------------------------------
### Install devtools-utils
Source: https://tanstack.com/devtools/latest/docs/devtools-utils.md
Install the `@tanstack/devtools-utils` package using npm.
```bash
npm install @tanstack/devtools-utils
```
--------------------------------
### Install Solid Devtools
Source: https://tanstack.com/devtools/latest/docs/installation.md
Install the Solid-specific Devtools package and the optional Vite plugin for enhanced features.
```bash
npm install -D @tanstack/solid-devtools
npm install -D @tanstack/devtools-vite
```
--------------------------------
### Vite Plugin Configuration Example
Source: https://tanstack.com/devtools/latest/docs/vite-plugin.md
Example of configuring the TanStack Devtools Vite plugin in your vite.config.js file. This shows basic setup and options.
```javascript
import devtools from "vite-plugin-solid-devtools";
export default {
plugins: [
devtools({
// enabled: true, // enable/disable devtools
// appendDevToolsScript: true, // inject devtools script into index.html
// autoConnect: true, // auto connect to devtools
// launchEditor: true, // enable 'go to source' feature
// vite: {
// // vite specific options
// },
}),
],
};
```
--------------------------------
### Install TanStack Devtools
Source: https://tanstack.com/devtools/latest/docs/framework/react/basic-setup.md
Install the TanStack Devtools library using npm. This command installs the core devtools and framework-specific adapters.
```bash
npm i @tanstack/react-devtools
```
--------------------------------
### React App Setup with TanStack Query and Devtools
Source: https://tanstack.com/devtools/latest/docs/framework/react/examples/basic
This snippet shows the main App component setup, including QueryClientProvider, Context Provider, and the rendering of Post and Posts components. It also includes the root rendering logic.
```jsx
import { createRoot } from 'react-dom/client'
import { createContext, useContext, useState } from 'react'
import { createPortal } from 'react-dom'
import {
QueryClient,
QueryClientProvider,
useQuery,
useQueryClient,
} from '@tanstack/react-query'
import Devtools from './setup'
import { queryPlugin } from './plugin'
import { Button } from './button'
import { Feature } from './feature'
const queryClient = new QueryClient({
defaultOptions: {
queries: {
gcTime: 1000 * 60 * 60 * 24, // 24 hours
},
},
})
type Post = {
id: number
title: string
body: string
}
function Posts({
setPostId,
}: {
setPostId: React.Dispatch {data.body} {
c.setCount(c.count + 1)
}}
>
{c.count}
Posts
{data.title}
```
--------------------------------
### Manual Plugin Object Example
Source: https://tanstack.com/devtools/latest/docs/devtools-utils.md
Use manual plugin objects for one-off internal devtools panels. This approach avoids extra abstraction.
```tsx
// Manual approach -- fine for one-off panels
{
name: 'App State',
render: (el, theme) => This is the modal content.
{data.body}
{ c.setCount(c.count + 1) }} > {c.count}
As you visit the posts below, you will notice them in a loading
state the first time you load them. However, after you return to
```
--------------------------------
### Vite Configuration for React Devtools
Source: https://tanstack.com/devtools/latest/docs/framework/react/examples/a11y-devtools
Configure Vite to include TanStack Devtools and React plugins. This setup is essential for enabling the devtools in your React project.
```typescript
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { devtools } from '@tanstack/devtools-vite'
export default defineConfig({
plugins: [
devtools(),
react(),
],
})
```
--------------------------------
### Basic React App with TanStack Query
Source: https://tanstack.com/devtools/latest/docs/framework/react/examples/basic
This snippet shows the root component of a React application configured with TanStack Query. It includes setting up the QueryClientProvider, rendering child components like Posts, Post, and Devtools, and the root element creation and rendering.
```jsx
import React, { useState, createContext } from 'react'
import { createRoot } from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { Posts } from './posts'
import { Post } from './post'
const Context = createContext
As you visit the posts below, you will notice them in a loading
state the first time you load them. However, after you return to
this list and click on any posts you have already visited again, you
will see them load instantly and background refresh right before
your eyes!{' '}
(You may need to throttle your network speed to simulate longer
loading sequences)
This page contains intentional accessibility issues to demonstrate the
A11y devtools plugin. Open the devtools panel and click "Run Audit" to
see the issues.
This text has poor color contrast and may be hard to read.
Full reactivity, hooks, signals"]
end
subgraph core["Devtools Core (Solid.js)"]
container["Plugin Container
<div id='plugin-container-{id}'>"]
end
comp -- "Portal / Teleport" --> container
```
--------------------------------
### Create Solid Plugin
Source: https://tanstack.com/devtools/latest/docs/devtools-utils.md
Use `createSolidPlugin` to create a Solid devtools plugin. It accepts an options object with `name`, `id`, `defaultOpen`, and a `Component` prop.
```typescript
function createSolidPlugin(options: {
name: string
id?: string
defaultOpen?: boolean
Component: (props: DevtoolsPanelProps) => JSX.Element
}): readonly [Plugin, NoOpPlugin]
```
```tsx
import { createSolidPlugin } from '@tanstack/devtools-utils/solid'
const [MyPlugin, NoOpPlugin] = createSolidPlugin({
name: 'My Store',
id: 'my-store',
Component: (props) => A11y Devtools Demo
Accessibility Issues Demo
{/* Issue: Image without alt text */}
1. Image without alt text
2. Button without accessible name
3. Form input without label
4. Low color contrast
6. Click handler on non-interactive element
7. Empty heading
8. Select without label
Accessible Content (for comparison)
Proper image with alt text
Proper button with label
Proper input with label