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

kicad-pcb-viewer

v1.1.0

Published

React components for 3D PCB visualization and 2D schematic viewing of KiCad files

Readme

kicad-pcb-viewer

React components for 3D PCB visualization and 2D schematic viewing of KiCad files — no server required, pure client-side parsing.

Install

npm install kicad-pcb-viewer
# peer deps (if not already installed)
npm install react react-dom three

Components

PCBViewer — 3D PCB Viewer

Renders a .kicad_pcb file as an interactive 3D board using Three.js.

import { PCBViewer } from 'kicad-pcb-viewer';

function App() {
  const [content, setContent] = useState('');

  const handleFile = (e: React.ChangeEvent<HTMLInputElement>) => {
    const file = e.target.files?.[0];
    if (!file) return;
    file.text().then(setContent);
  };

  return (
    <div>
      <input type="file" accept=".kicad_pcb" onChange={handleFile} />
      {content && (
        <PCBViewer
          content={content}
          fileName="my-board.kicad_pcb"
          height="600px"
          width="100%"
          solderMaskColor="green"
          copperFinish="enig"
        />
      )}
    </div>
  );
}

PCBViewerProps

| Prop | Type | Default | Description | |------|------|---------|-------------| | content | string | required | Raw .kicad_pcb file content | | fileName | string | 'PCB' | Display name in the header | | height | string | '600px' | CSS height of the viewer | | width | string | '100%' | CSS width of the viewer | | defaultSidebarOpen | boolean | true | Show sidebar on load | | defaultVisibility | Partial<VisibilityState> | — | Override initial layer visibility | | solderMaskColor | 'green' \| 'blue' \| 'red' \| 'black' \| 'white' | 'green' | Board solder mask colour | | copperFinish | 'enig' \| 'hasl' \| 'osp' \| 'bare' | 'enig' | Copper finish type |


KiCadSchViewerEmbed — 2D Schematic Viewer

Renders a .kicad_sch file as an interactive 2D schematic — pan, zoom, hover tooltips, dark/light themes.

import { KiCadSchViewerEmbed } from 'kicad-pcb-viewer';

function App() {
  const [content, setContent] = useState('');

  const handleFile = (e: React.ChangeEvent<HTMLInputElement>) => {
    const file = e.target.files?.[0];
    if (!file) return;
    file.text().then(setContent);
  };

  return (
    <div style={{ height: '600px' }}>
      <input type="file" accept=".kicad_sch" onChange={handleFile} />
      {content && (
        <KiCadSchViewerEmbed
          content={content}
          fileName="my-schematic.kicad_sch"
          initialTheme="dark"
        />
      )}
    </div>
  );
}

KiCadSchViewerEmbedProps

| Prop | Type | Default | Description | |------|------|---------|-------------| | content | string | required | Raw .kicad_sch file content | | fileName | string | '' | Shown in the toolbar header | | initialTheme | 'dark' \| 'light' | 'dark' | Initial colour theme |

Controls: Scroll to zoom · Drag to pan · Hover symbols for reference/value tooltip.


KiCadSchViewer (default export) — Standalone Schematic Page

A full-page drop-zone wrapper around KiCadSchViewerEmbed. Useful as a standalone route/page — the user drops a .kicad_sch file and it renders immediately.

import KiCadSchViewer from 'kicad-pcb-viewer';

// Renders a full-page file drop zone → schematic viewer
function SchPage() {
  return <KiCadSchViewer />;
}

Utility exports (PCB)

import {
  parsePCB,               // (content: string) => PCBData
  generateArcPoints,      // arc point interpolation helper
  reconstructBoardOutline,// board outline polygon builder
  COLORS_3D,              // Three.js colour constants
} from 'kicad-pcb-viewer';

Types

import type {
  // PCB
  PCBViewerProps, PCBData, Footprint, Pad,
  Segment, Arc, Via, ZonePolygon,
  BoardOutlineSegment, VisibilityState,
  // Schematic
  KiCadSchViewerEmbedProps,
} from 'kicad-pcb-viewer';

Example: show both viewers side-by-side

import { useState } from 'react';
import { PCBViewer, KiCadSchViewerEmbed } from 'kicad-pcb-viewer';

export default function Demo() {
  const [pcb, setPcb] = useState('');
  const [sch, setSch] = useState('');

  const load = (setter: (s: string) => void) =>
    (e: React.ChangeEvent<HTMLInputElement>) =>
      e.target.files?.[0]?.text().then(setter);

  return (
    <div style={{ display: 'flex', gap: 16, height: '100vh' }}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
        <input type="file" accept=".kicad_pcb" onChange={load(setPcb)} />
        {pcb && <PCBViewer content={pcb} height="100%" />}
      </div>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
        <input type="file" accept=".kicad_sch" onChange={load(setSch)} />
        {sch && <KiCadSchViewerEmbed content={sch} height="100%" />}
      </div>
    </div>
  );
}

Build

npm run build   # outputs CJS + ESM + .d.ts to dist/

License

MIT