npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ytspar/devbar

v1.18.1

Published

Development toolbar and utilities with Sweetlink integration - pure vanilla JS, no framework dependencies

Downloads

3,275

Readme

@ytspar/devbar

npm

Development toolbar with Sweetlink integration for browser-based development tools.

Features

  • Breakpoint indicator: Shows current Tailwind breakpoint and viewport dimensions
  • Performance metrics: FCP, LCP, and total page size
  • Console badges: Error and warning counts with click-to-view logs
  • Screenshot capture: Save to file or copy to clipboard
  • AI Design Review: Send screenshots to Claude for design analysis
  • Document Outline: View and export page heading structure
  • Page Schema: View JSON-LD, Open Graph, and meta tag data
  • Sweetlink integration: Real-time connection to dev server

Requirements

This package is ESM-only. It requires "type": "module" in your package.json or an ESM-capable bundler (Vite, webpack, esbuild, etc.).

Installation

pnpm add @ytspar/devbar

# Or install canary (latest from main)
pnpm add @ytspar/devbar@canary

Usage

Basic Setup (Vanilla JS)

import { initGlobalDevBar } from '@ytspar/devbar';

// Initialize with default options
initGlobalDevBar();

// Or with custom options
initGlobalDevBar({
  position: 'bottom-left',
  accentColor: '#10b981',
});

In a Vite/React Project

// main.ts or App.tsx
if (import.meta.env.DEV) {
  import('@ytspar/devbar').then(({ initGlobalDevBar }) => {
    initGlobalDevBar({
      position: 'bottom-center',
      showTooltips: true,
    });
  });
}

In a Next.js Project

Create a client component that dynamically imports the devbar:

// src/providers/DevBar.tsx
'use client';

import { useEffect } from 'react';

export function DevBar() {
  useEffect(() => {
    if (process.env.NODE_ENV === 'development') {
      import('@ytspar/devbar').then(({ initGlobalDevBar }) => {
        initGlobalDevBar();
      });
    }
  }, []);

  return null;
}

Add it to your root layout, outside the provider tree:

// src/app/layout.tsx
import { DevBar } from '@/providers/DevBar';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <DevBar />
      </body>
    </html>
  );
}

The dynamic import ensures the devbar is fully tree-shaken from production builds.

Positions

The devbar can be placed in five positions:

| Position | Description | |----------|-------------| | bottom-left | Bottom left corner (default) - leaves room for other dev tools on the right | | bottom-right | Bottom right corner | | top-left | Top left corner | | top-right | Top right corner | | bottom-center | Centered at bottom - ideal for focused development, responsive at mobile sizes |

// Example: Center the devbar at the bottom
initGlobalDevBar({ position: 'bottom-center' });

On mobile viewports (<640px), all positions automatically center and the action buttons wrap to a second row.

Configuration Options

interface GlobalDevBarOptions {
  /** Position of the devbar. Default: 'bottom-left' */
  position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'bottom-center';

  /** Primary accent color (CSS color). Default: '#10b981' (emerald) */
  accentColor?: string;

  /** First-run/reset theme mode when no saved preference exists. Default: 'system' */
  defaultThemeMode?: 'dark' | 'light' | 'system';

  /** Force a theme mode for host apps that do not support every DevBar theme */
  themeMode?: 'dark' | 'light' | 'system';

  /** Which metrics to show. Default: all enabled */
  showMetrics?: {
    breakpoint?: boolean;  // Tailwind breakpoint indicator
    fcp?: boolean;         // First Contentful Paint
    lcp?: boolean;         // Largest Contentful Paint
    pageSize?: boolean;    // Total transfer size
  };

  /** Whether to show the screenshot button. Default: true */
  showScreenshot?: boolean;

  /** Whether to show console error/warning badges. Default: true */
  showConsoleBadges?: boolean;

  /** Whether to show tooltips on hover. Default: true */
  showTooltips?: boolean;

  /** Size overrides for special layouts */
  sizeOverrides?: {
    width?: string;
    maxWidth?: string;
    minWidth?: string;
  };
}

Example: Minimal DevBar

initGlobalDevBar({
  showMetrics: {
    breakpoint: true,
    fcp: false,
    lcp: false,
    pageSize: false,
  },
  showScreenshot: false,
  showConsoleBadges: true,
  showTooltips: false,  // Disable tooltips
});

Custom Controls

Register custom buttons that appear in the devbar:

import { GlobalDevBar } from '@ytspar/devbar';

// Register a custom control
GlobalDevBar.registerControl({
  id: 'my-control',
  label: 'Reset State',
  tooltip: 'Clears localStorage and reloads the current page',
  onClick: () => {
    localStorage.clear();
    location.reload();
  },
  variant: 'warning',  // 'default' | 'warning'
});

// Unregister when done
GlobalDevBar.unregisterControl('my-control');

Release Info Plugin

Show release metadata without taking over the toolbar:

import { releaseInfoPlugin } from '@ytspar/devbar/plugins/release-info';

const cleanupRelease = releaseInfoPlugin({
  version: '1.4.2',
  releasedAt: '2026-05-06T06:21:23Z',
  changelog: [
    'Show DevBar on staging deploys',
    'Expose release timestamp, version, and changelog metadata',
  ],
});

// Unregister when done
cleanupRelease();

The badge displays the version and formatted release timestamp. Hovering the badge shows the exact release time and changelog lines.

Cleanup

import { destroyGlobalDevBar } from '@ytspar/devbar';

// Remove the devbar and cleanup listeners
destroyGlobalDevBar();

Keyboard Shortcuts

  • Cmd/Ctrl + Shift + S: Save screenshot to file
  • Cmd/Ctrl + Shift + C: Copy screenshot to clipboard
  • Escape: Close any open modal/popup

Integration with Sweetlink

The devbar automatically connects to the Sweetlink WebSocket server (port 9223) for:

  • Screenshot saving to the project directory
  • AI-powered design review via Claude
  • Document outline and schema export

For proxied local URLs such as Portless (https://myapp.localhost), use the Sweetlink Vite or Next integration so the real internal app/WebSocket ports are injected automatically. If you run Sweetlink manually behind a proxy, pass both the internal app port and WebSocket port:

initGlobalDevBar({
  sweetlink: { appPort: 4123, wsPort: 10346 }
});

For screenshot evidence where the toolbar should not appear, use Sweetlink's capture flag:

pnpm sweetlink screenshot --hide-devbar
pnpm sweetlink screenshot --hifi --hide-devbar

When Sweetlink is not running, the devbar still functions but file-saving features are disabled.

Early Console Capture

Console logs are captured from the moment the devbar module loads, before your app initializes. This catches:

  • All console.log/error/warn/info calls
  • Errors that occur during hydration
  • Early initialization issues

Dependencies

  • html2canvas-pro - Screenshot capture

License

MIT