Menu
NextToolbar

Configuration

The theme prop, the recommended next.config options, basePath and assetPrefix.

NextToolbar needs no configuration to work. This page lists what you can configure, in the component and in next.config.

Props

tsx
<NextToolbar theme="system" />
PropTypeDefaultDescription
theme'system' | 'light' | 'dark''system'Initial theme. system follows the OS preference. The theme button in the toolbar overrides it and remembers the choice per browser.

The package also exports the types NextToolbarProps and Theme.

next.config options

OptionRecommendedWhy
experimental.requestInsightstrue (Next 16)Unlocks server timing, fetches with cache outcome, server errors, exact route patterns, the no-store render-mode correction and the profiler.
devIndicators{ position: 'top-right' } or falseNext's indicator sits bottom-left by default, on top of the toolbar's logo.
next.config.ts
ts
import type { NextConfig } from 'next'
 
const nextConfig: NextConfig = {
  devIndicators: { position: 'top-right' },
  experimental: { requestInsights: true },
}
 
export default nextConfig

requestInsights only exists in Next 16. Next 15 ignores it, so the same config works on both.

basePath and assetPrefix

Both work without extra configuration:

  • The toolbar finds the dev server's socket the same way Next's own client does: from the path of Next's scripts (everything before /_next/). That covers basePath, and assetPrefix including a CDN URL.
  • Next writes basePath into the toolbar's code at build time (process.env.__NEXT_ROUTER_BASEPATH), so it can match URLs that include it (/docs/blog/hello) with the paths Next reports without it (/blog/hello).

Persisted preferences

The toolbar stores two small preferences in the browser's localStorage, per origin:

KeyValuesSet by
next-toolbar:collapsed'1' or '0'Minimizing / expanding the toolbar
next-toolbar:theme'system', 'light', 'dark'The theme button

Clear them to go back to the defaults. If localStorage is unavailable (private mode, blocked storage), the toolbar still works and simply doesn't remember.

Error boundary

Not a toolbar option, but worth repeating: add app/error.tsx so a render error doesn't take the root layout, and the toolbar, down with it. See Getting started.

Demo component

NextToolbarDemo renders the same toolbar from data you pass in, in any environment, production included. It's what powers the live demo; use it for documentation, screenshots or showcases, not in your app.

app/showcase/page.tsx
tsx
'use client'
import { NextToolbarDemo } from '@angelitolm/next-toolbar'
 
export default function Showcase() {
  return <NextToolbarDemo pathname="/blog/hello" params={{ slug: 'hello' }} status={200} timingMs={42} isStatic />
}
PropDescription
pathname, paramsThe simulated page
status, timingMs, viaHTTP status and TTFB ('document') or navigation time ('rsc')
isStaticWhat Next's dev data says: true, false, or omitted for "Rendering…"
insightsSimulated request insights (types Insight, InsightFetch, InsightSpan are exported)
clientErrorsClient errors with message and optional stack
nextVersion, themeDefaults: '16.3.6' and 'system'

Production

There is nothing to switch off. The toolbar renders null whenever NODE_ENV isn't development.