Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

tscircuit/builder

Repository files navigation

@tscircuit/builder

tscircuit docs · github · tscircuit · discord · builder reference docs

TSCircuit Builder is a Typescript builder pattern for constructing schematic and PCB layouts. @tscircuit/builder is an internal module, use tscircuit tsx instead. The builder is basically "the DOM for building circuits"

Warning

@tscircuit/builder is replaced by @tscircuit/core

TSCircuit TSX eventually renders to a builder. The builder will build TSCircuit Soup, a JSON output. Soup can be rendered to a webpage as either a schematic or PCB layout.

Note

Why not go directly from TSX -> Schematic/PCB?

If you think about how React works, there's a layer between React and the rendered HTML image you see on your screen, that layer is the DOM. The DOM simplifies the amount of work React has to do. In the same way, the Builder simplifies the amount of work that the TSCircuit TSX have to do while providing a lot of flexibility for different renderers. It's like the DOM for Circuits.

Example

const projectBuilder = await createProjectBuilder()
  .add("resistor", (rb) =>
    rb
      .setProps({
        resistance: "10 ohm",
        name: "R1",
        schX: 2,
        schY: 1
      })
  )

const projectBuilderOutput = await projectBuilder.build()


/*
// Soup JSON, very verbose! Looks easy to render though!
[
  {
    ftype: 'simple_resistor',
    name: 'R1',
    resistance: '10 ohm',
    source_component_id: 'simple_resistor_0',
    type: 'source_component',
  },
  {
    center: {
      x: 2,
      y: 1,
    },
    rotation: 0,
    schematic_component_id: 'schematic_component_simple_resistor_0',
    size: {
      height: 0.3,
      width: 1,
    },
    source_component_id: 'simple_resistor_0',
    type: 'schematic_component',
  },
  ...
]

Installation

npm install --save @tscircuit/builder

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 7