Skip to content
/ core Public

Create electronics with Typescript and React. Compile Typescript to Circuit JSON

License

Notifications You must be signed in to change notification settings

tscircuit/core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

930295f · Feb 28, 2025
Feb 23, 2025
Feb 13, 2025
Feb 28, 2025
Jan 25, 2025
Feb 28, 2025
Feb 28, 2025
Jan 17, 2025
Jan 19, 2025
Feb 14, 2025
Jan 17, 2025
Feb 28, 2025
Aug 31, 2024
Aug 24, 2024
Feb 28, 2025
Jan 17, 2025

Repository files navigation

@tscircuit/core

The core logic used to build Circuit JSON from tscircuit React elements.

tscircuit · Development Guide · Core Benchmarks

You can use core to create Circuit JSON, which can then be converted into Gerbers, viewed online, and much more.

Usage

import { Circuit } from "@tscircuit/core"

const circuit = new Circuit()

circuit.add(
  <board width="10mm" height="10mm">
    <resistor name="R1" resistance="10k" footprint="0402" />
    <led name="L1" footprint="0402" />

    <trace from=".R1 > .pin1" to="net.VCC" />
    <trace from=".R1 > .pin2" to=".L1 > .pos" />
    <trace from=".L1 > .neg" to="net.GND" />
  </board>
)

circuit.getCircuitJson()

Non-React Usage

import { Board, Resistor, Led, Trace, Circuit } from "@tscircuit/core"

const circuit = new Circuit()

const board = new Board({
  width: "10mm",
  height: "10mm",
})
project.add(board)

const R1 = new Resistor({ resistance: "10k", footprint: "0402" })
board.add(R1)

// You can also add elements with React
board.add(<led footprint="0402" />)

const trace = new Trace({ width: "0.2mm" })
trace.connect(R1.output, LED1.anode)
board.add(trace)

circuit.getJson() // [{ type: "board", ...}, { type: "resistor", ...}, ...]