🔥 All-Access Pass — $199 USD (Regular $499) · Unlock all 2,836 Astro themes ➔
komal.nakrani
Get All-Access Pass ($199)
ThemesCategoriesDocsBlogTips & TricksPricingGet All-Access Pass ($199)
Astro Fundamentals••By Komal Nakrani

Astro Dev Toolbar: Built-in Apps and Custom Apps

The Astro dev toolbar explained: use Inspect and Audit to find island and accessibility issues, change settings, disable it, and build your own toolbar app.

#Astro#Dev Toolbar#Developer Experience#Accessibility

The Astro dev toolbar is the small bar Astro injects at the bottom of every page while astro dev is running. It ships with four built-in apps (Menu, Inspect, Audit and Settings) that show your islands, flag accessibility and performance problems, and control the toolbar itself, and integrations can add their own apps. It never appears in a production build.

This guide covers what each built-in app does, how to act on its findings, how to move or disable the toolbar, and how to write a small custom toolbar app for your own project.

Key Takeaways

  • The toolbar only exists in development. astro build output contains none of it.
  • Inspect highlights every island on the page and shows its props and client:* directive.
  • Audit runs accessibility and performance rules against the rendered page, live.
  • Disable it per project with devToolbar.enabled: false, or just for yourself with astro preferences disable devToolbar.
  • Custom apps are added by an integration with addDevToolbarApp() and written with defineToolbarApp() from astro/toolbar.

What the Astro dev toolbar is for

Most bugs in an Astro site are not JavaScript bugs. They are an image missing alt, a hero image that is lazy-loaded when it should be eager, or an island that hydrates on load when it could wait until it is visible. Those problems are easy to miss in code review because the page looks fine.

The dev toolbar checks the page you are looking at in the browser, while you work on it. It runs against the real rendered HTML, so it catches problems that come from content, props or CMS data, not only from your templates. Treat it as a first pass: it will not replace a full accessibility audit or a Lighthouse run, but it catches the common mistakes before they ship.

The four built-in apps

Click an icon in the toolbar to open its app. Only one app is open at a time.

App What it does
Menu Shows your Astro version, links to docs and community, and lists apps added by integrations
Inspect Outlines every island on the page; hover or click for its props and hydration directive
Audit Runs accessibility and performance rules and marks failing elements on the page
Settings Toggles notifications, verbose logging, and the toolbar’s placement

Inspect: see your islands

Open Inspect and every component that ships JavaScript gets an outline. Hover one to see its name; click to see the props it received and which client:* directive hydrates it. Static components get no outline, because they ship no JavaScript.

Inspect is the fastest way to answer “why is this page shipping so much JS”. If you see a large island hydrating with client:load that sits below the fold, switch it to client:visible or client:idle. The client directives guide explains each option, and lazy-loading islands shows the pattern.

Audit: accessibility and performance checks

Audit runs a set of rules against the current page and draws a marker on every element that fails. Click a marker for the rule, the reason, and a link to more information. The badge on the Audit icon shows how many problems it found, so you notice new ones without opening the app.

The accessibility rules cover the usual problems: images without alt, links and buttons without accessible names, form inputs without labels, invalid ARIA roles and attributes, and similar issues drawn from established checks. The performance rules are Astro-specific and worth knowing by name:

  • Use the Image component: a local image rendered with a plain <img> instead of <Image />.
  • Unoptimized loading attribute: an image above the fold marked loading="lazy", or one far below the fold that is not lazy.
  • Use videos instead of GIFs for large animations: large animated GIFs that would be much smaller as video.
  • Server-rendered component took a long time to render and Client-rendered component took a long time to hydrate: slow components that are dragging down the page.

The image rules connect directly to Largest Contentful Paint. If Audit flags your hero, add priority to its <Image />; the Astro image component guide covers how.

Settings

Settings has three controls. Disable notifications hides the badges on app icons. Verbose logging prints toolbar activity to the browser console, useful when debugging a custom app. Placement moves the toolbar to the bottom left, center or right. Your choice is saved in localStorage and overrides the config for you only.

Configure or disable the toolbar

The toolbar is on by default. Two config options control it for the whole project:

// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
  devToolbar: {
    enabled: true,
    placement: 'bottom-right', // 'bottom-left' | 'bottom-center' | 'bottom-right'
  },
});

Setting enabled: false removes it for everyone working on the project. That is a heavy choice for a team, because colleagues lose the audits too. If the toolbar only bothers you, turn it off in your own preferences instead:

# this project only
npx astro preferences disable devToolbar

# every Astro project on this machine
npx astro preferences disable devToolbar --global

astro preferences enable devToolbar turns it back on, and astro preferences list shows your current settings. The Astro CLI cheatsheet lists the other preference commands.

Day to day, the toolbar stays collapsed to a small tab and only expands when your pointer moves over it, so it rarely covers anything. It also hides itself when you print the page.

Build a custom toolbar app

Toolbar apps are small client scripts that get a Shadow DOM root to draw into. They are added by integrations, so even a project-only app needs a tiny local integration. Here is an app that lists every heading on the page, a quick way to check heading order on content pages.

First, the app itself:

// src/toolbar/headings-app.ts
import { defineToolbarApp } from 'astro/toolbar';

export default defineToolbarApp({
  init(canvas, app) {
    const win = document.createElement('astro-dev-toolbar-window');
    canvas.appendChild(win);

    const render = () => {
      const headings = [...document.querySelectorAll('h1, h2, h3, h4')];
      win.innerHTML = `
        <h2 style="margin-top:0">Headings (${headings.length})</h2>
        <ol style="margin:0;padding-left:1.25rem">
          ${headings
            .map((h) => `<li>${h.tagName.toLowerCase()}: ${h.textContent?.trim() ?? ''}</li>`)
            .join('')}
        </ol>`;

      const h1Count = headings.filter((h) => h.tagName === 'H1').length;
      app.toggleNotification({ state: h1Count !== 1, level: 'warning' });
    };

    render();
    app.onToggled(({ state }) => {
      if (state) render();
    });
  },
});

canvas is the app’s Shadow DOM root, so its styles do not leak into your page. astro-dev-toolbar-window is one of the built-in UI elements, which gives your app the same look as the core apps. toggleNotification() puts a badge on the icon; here it warns when a page does not have exactly one h1.

Then register it with a local integration:

// src/integrations/headings-toolbar.ts
import type { AstroIntegration } from 'astro';

export default function headingsToolbar(): AstroIntegration {
  return {
    name: 'headings-toolbar',
    hooks: {
      'astro:config:setup': ({ addDevToolbarApp }) => {
        addDevToolbarApp({
          id: 'headings-app',
          name: 'Headings',
          icon: 'file-search',
          entrypoint: new URL('../toolbar/headings-app.ts', import.meta.url),
        });
      },
    },
  };
}
// astro.config.mjs
import { defineConfig } from 'astro/config';
import headingsToolbar from './src/integrations/headings-toolbar.ts';

export default defineConfig({
  integrations: [headingsToolbar()],
});

Restart the dev server and a Headings icon appears next to the built-in apps. The icon field accepts one of the toolbar’s built-in icon names, such as file-search, gauge or puzzle, or an inline SVG string.

Ideas for project-specific apps

Custom apps are most useful when they encode checks specific to your project, things no general tool knows about:

  1. Content checks: warn when a blog page has no meta description, or when the title is longer than 60 characters.
  2. Design token checks: highlight elements using hard-coded colors instead of your CSS variables.
  3. Link checks: mark internal links missing a trailing slash if your site uses trailingSlash: 'always'.
  4. Client handoff: a panel listing the content files used on the current page, so an editor knows what to change.

The third argument to init() is a server helper that sends and receives messages between the app and your integration on the dev server. Use it when a check needs the file system, such as reading a content file. The dev toolbar app API reference documents the events, UI elements and server helpers.

When the toolbar gets in the way

The toolbar is injected into every page in dev, which occasionally causes friction:

  • Screenshot and visual tests that run against astro dev will capture it. Run visual tests against astro preview instead, which serves the production build and never includes the toolbar.
  • Pages with their own fixed footer can be partly covered. Move the toolbar with placement, or hide it while you work on that area.
  • Embedded pages in iframes also show it. That is expected in dev and disappears in the build.

None of these affect production. The toolbar’s script is added by the dev server only, so there is nothing to strip or configure before deploying. For a full tour of where config lives in a project, see the Astro config docs.

The audits are also a quick way to judge a starter or theme before you commit to it: open a few pages with the toolbar and see what it flags. If you are comparing options, browse Astro themes with live previews and run the same check on a cloned copy.

FAQ

How do I turn off the Astro dev toolbar?

For yourself, run npx astro preferences disable devToolbar in the project, or add --global for every project. For the whole team, set devToolbar: { enabled: false } in astro.config.mjs.

Does the Astro dev toolbar appear in production?

No. The dev server injects it only while astro dev runs. Builds and astro preview never include it.

What does the Audit app check?

It runs accessibility rules, such as missing alt text, missing labels and invalid ARIA, plus Astro performance rules for image optimization, lazy loading, large GIFs, and slow server rendering or hydration.

Can I add my own app to the Astro dev toolbar?

Yes. Write the app with defineToolbarApp() from astro/toolbar, then register it from an integration’s astro:config:setup hook with addDevToolbarApp(), passing an id, name, icon and entrypoint.

Why can’t I see islands in the Inspect app?

Inspect only outlines components that ship JavaScript. If your page has no client:* directives, there are no islands to show, which is the ideal for a content page.