Add the Vercel Toolbar to your local environment
Last updated March 17, 2025
To enable the toolbar in your local environment, add it to your project using the @vercel/toolbar package, or with an injection script.
Install the package using the following command:
pnpm i @vercel/toolbarThen link your local project to your Vercel project with the
vercel linkcommand using Vercel CLI.terminalvercel link [path-to-directory]To use the Vercel Toolbar locally in a Next.js project, define
withVercelToolbarin yournext.config.jsfile and export it, as shown below:next.config.js/** @type {import('next').NextConfig} */ const createWithVercelToolbar = require('@vercel/toolbar/plugins/next'); const nextConfig = { // Config options here }; const withVercelToolbar = createWithVercelToolbar(); // Instead of module.exports = nextConfig, do this: module.exports = withVercelToolbar(nextConfig);Then add the following code to your
layout.tsxorlayout.jsxfile:app/layout.tsximport { VercelToolbar } from '@vercel/toolbar/next'; export default function RootLayout({ children, }: { children: React.ReactNode; }) { const shouldInjectToolbar = process.env.NODE_ENV === 'development'; return ( <html lang="en"> <body> {children} {shouldInjectToolbar && <VercelToolbar />} </body> </html> ); }
Was this helpful?