@tscircuit/pcb-viewer
TypeScript icon, indicating that this package has built-in type declarations

1.11.107 • Public • Published

@tscircuit/pcb-viewer

npm version

Examples · TSCircuit · Open in CodeSandbox

Render Printed Circuit Boards w/ React

If you want to render to an image, check out circuit-to-png

image

Usage

npm install @tscircuit/pcb-viewer

There are two main ways to use the PCBViewer:

1. Using Circuit Components

This approach allows you to declaratively define your circuit using React components:

import React from "react"
import { PCBViewer } from "@tscircuit/pcb-viewer"

export default () => {
  return (
    <div style={{ backgroundColor: "black" }}>
      <PCBViewer>
        <resistor footprint="0805" resistance="10k" />
        <capacitor footprint="0603" capacitance="100nF" />
      </PCBViewer>
    </div>
  )
}

2. Using Circuit JSON

If you already have circuit JSON data, you can pass it directly:

import React from "react"
import { PCBViewer } from "@tscircuit/pcb-viewer"

const circuitJson = [
  {
    type: "pcb_component",
    pcb_component_id: "R1",
    center: { x: 0, y: 0 },
    // ... other component properties
  },
  // ... more elements
]

export default () => {
  return (
    <div style={{ backgroundColor: "black" }}>
      <PCBViewer circuitJson={circuitJson} />
    </div>
  )
}

Props

The PCBViewer component accepts these props:

  • children: Circuit components to render
  • circuitJson: Circuit JSON elements array (alternative to children)
  • height: Height of viewer in pixels (default: 600)
  • allowEditing: Enable/disable editing capabilities (default: true)
  • editEvents: Array of edit events to apply
  • onEditEventsChanged: Callback when edit events change
  • initialState: Initial state for the viewer

Features

  • Interactive PCB viewing with pan and zoom
  • Multiple layer support (top, bottom, inner layers)
  • Component placement editing
  • Trace routing
  • DRC (Design Rule Check) visualization
  • Measurement tools

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.11.10746latest

Version History

VersionDownloads (Last 7 Days)Published
1.11.10746
1.11.10659
1.11.10569
1.11.104120
1.11.10355
1.11.102126
1.11.10174
1.11.10066
1.11.991,366
1.11.9879
1.11.9736
1.11.9611
1.11.9510
1.11.92237
1.11.91247
1.11.900
1.11.890
1.11.880
1.11.870
1.11.860
1.11.850
1.11.841
1.11.830
1.11.820
1.11.812
1.11.800
1.11.791
1.11.780
1.11.771
1.11.760
1.11.750
1.11.741
1.11.731
1.11.721
1.11.710
1.11.701
1.11.690
1.11.680
1.11.670
1.11.660
1.11.650
1.11.640
1.11.630
1.11.620
1.11.611
1.11.600
1.11.590
1.11.580
1.11.570
1.11.561
1.11.550
1.11.540
1.11.531
1.11.520
1.11.510
1.11.501
1.11.490
1.11.480
1.11.471
1.11.461
1.11.450
1.11.441
1.11.431
1.11.420
1.11.410
1.11.400
1.11.391
1.11.380
1.11.370
1.11.361
1.11.351
1.11.340
1.11.330
1.11.320
1.11.310
1.11.300
1.11.290
1.11.282
1.11.271
1.11.260
1.11.250
1.11.240
1.11.230
1.11.220
1.11.210
1.11.200
1.11.190
1.11.181
1.11.171
1.11.160
1.11.150
1.11.140
1.11.130
1.11.120
1.11.111
1.11.101
1.11.90
1.11.80
1.11.71
1.11.61
1.11.50
1.11.40
1.11.30
1.11.2106
1.11.11
1.10.260
1.10.2512
1.10.240
1.10.231
1.10.221
1.10.210
1.10.200
1.10.191
1.10.180
1.10.170
1.10.161
1.10.150
1.10.140
1.10.131
1.10.120
1.10.110
1.10.100
1.10.920
1.10.80
1.10.70
1.10.60
1.10.57
1.10.41
1.10.30
1.10.21
1.10.10
1.10.00
1.9.30
1.9.21
1.9.10
1.9.00
1.8.20
1.8.10
1.8.01
1.7.00
1.6.034
1.5.01
1.4.60
1.4.515
1.4.40
1.4.31
1.4.21
1.4.11
1.4.00
1.3.140
1.3.131
1.3.121
1.3.110
1.3.101
1.3.90
1.3.80
1.3.70
1.3.60
1.3.50
1.3.40
1.3.30
1.3.20
1.3.10
1.3.01
1.2.261
1.2.251
1.2.240
1.2.231
1.2.220
1.2.210
1.2.200
1.2.190
1.2.180
1.2.170
1.2.160
1.2.151
1.2.140
1.2.130
1.2.121
1.2.110
1.2.100
1.2.90
1.2.80
1.2.71
1.2.60
1.2.50
1.2.40
1.2.30
1.2.20
1.2.10
1.2.00
1.1.01
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @tscircuit/pcb-viewer

Weekly Downloads

2,849

Version

1.11.107

License

MIT

Unpacked Size

1.01 MB

Total Files

6

Last publish

Collaborators

  • seveibar