This file is a merged representation of a subset of the codebase, containing specifically included files, combined into a single document by Repomix.
This section contains a summary of this file.
This file contains a packed representation of the entire repository's contents.
It is designed to be easily consumable by AI systems for analysis, code review,
or other automated processes.
The content is organized as follows:
1. This summary section
2. Repository information
3. Directory structure
4. Repository files, each consisting of:
- File path as an attribute
- Full contents of the file
- This file should be treated as read-only. Any changes should be made to the
original repository files, not this packed version.
- When processing this file, use the file path to distinguish
between different files in the repository.
- Be aware that this file may contain sensitive information. Handle it with
the same level of security as you would the original repository.
- Some files may have been excluded based on .gitignore rules and Repomix's configuration
- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files
- Only files matching these patterns are included: **/*.md, **/*.mdx
- Files matching patterns in .gitignore are excluded
- Files matching default ignore patterns are excluded
docs/
advanced/
ai-context.mdx
math-utils.mdx
units.md
building-electronics/
designing-electronics-from-scratch.md
ordering-prototypes.mdx
what-are-electronics-made-of.mdx
command-line/
tsci-add.mdx
tsci-dev.md
tsci-export.md
tsci-init.md
tsci-login.md
contributing/
bounties-and-sponsorship.md
getting-started-as-a-contributor.md
overview-of-projects.md
the-contributor-handbook.md
elements/
board.mdx
capacitor.mdx
chip.mdx
crystal.mdx
diode.mdx
footprint.mdx
group.mdx
hole.mdx
led.mdx
mosfet.mdx
net.mdx
pinheader.mdx
potentiometer.mdx
pushbutton.mdx
resistor.mdx
resonator.mdx
subcircuit.mdx
switch.mdx
trace.mdx
transistor.mdx
via.mdx
footprints/
constraint.mdx
footprint-elements-vs-footprint-strings.mdx
footprinter-strings.mdx
platedhole.mdx
silkscreencircle.mdx
silkscreenline.mdx
silkscreenpath.mdx
silkscreenrect.mdx
silkscreentext.mdx
smtpad.mdx
guides/
importing-modules-and-chips/
importing-from-circuit-json.mdx
importing-from-jlcpcb.mdx
importing-from-kicad.md
automatic-layout.mdx
configuring-chips.mdx
displaying-circuit-json-on-a-webpage.mdx
essential-elements.mdx
layout-properties.mdx
manual-edits.mdx
platform-configuration.md
port-and-net-selectors.md
programmatically-building-circuits.md
publishing-modules.md
running-tscircuit-inside-an-iframe.mdx
understanding-fabrication-files.md
using-sel-references.mdx
using-tscircuit-without-react.mdx
intro/
installation.md
quickstart-cli.md
quickstart-web.md
what-is-tscircuit.mdx
tutorials/
building-a-simple-usb-flashlight.mdx
web-apis/
autorouting-api.mdx
the-registry-api.md
README.md
This section contains the contents of the repository's files.
---
title: AI Context
description: Learn how to use our AI context to help you design with tscircuit
---
## Overview
You can drop our AI context into your Claude or OpenAI project by downloading
the [`ai.txt`](https://docs.tscircuit.com/ai.txt) file and dropping it into your project.
This will teach Claude and OpenAI about tscircuit so it can help you design
boards or access tricky or hidden pieces of the documentation!
You can also use our [Official GPT on ChatGPT](https://chatgpt.com/g/g-67b2911b5af08191bdde2d4a0c8c1076-tscircuit-helper) or [chat.tscircuit.com](https://chat.tscircuit.com)
for prebuilt versions of the AI. Note: [chat.tscircuit.com](https://chat.tscircuit.com)
contains live preview for a great development experience.
---
title: Math Utils
---
## Overview
The `@tscircuit/math-utils` package provides a set of utilities that are
commonly used in circuit design. The `@tscircuit/math-utils` package is
generally available in any platform that uses `tscircuit`.
The source code for the `@tscircuit/math-utils` package [is available here](https://github.com/tscircuit/math-utils)
## `grid`
A utility function that generates a grid of cells with configurable dimensions, spacing, and positioning. Each cell contains its index, position (row/column), and coordinate points (center, top-left, bottom-right).
```tsx
import { grid } from "@tscircuit/math-utils"
const gridCells = grid({
rows: 3,
cols: 3,
width: 300, // optional
height: 300, // optional
xSpacing: 100, // optional, default: 1
ySpacing: 100, // optional, default: 1
offsetX: 0, // optional, default: 0
offsetY: 0, // optional, default: 0
yDirection: "cartesian", // optional, default: "cartesian"
centered: true // optional, default: true
})
export default () => (
{gridCells.map((cell) => (
))}
)
```
The array of `GridCellPositions` contains:
- `index`: Sequential cell number
- `row`, `col`: Grid position
- `center`, `topLeft`, `bottomRight`: Coordinate points
---
title: tscircuit Units
---
In tscircuit you can specify a unit explicitly with a string e.g. "0.1mm", but
you can also also specify numbers without units and the unit will be inferred
from [platform](../guides/platform-configuration.md), [board configuration](../elements/board.mdx), [subcircuit configuration](../elements/subcircuit.mdx)
or the defaults below
## Default Units
By default, tscircuit uses the following base units:
| Measurement Type | Base Unit | Description |
| ---------------- | --------- | ------------ |
| Length | mm | Millimeters |
| Time | ms | Milliseconds |
| Mass | g | Grams |
| Angle | deg | Degrees |
| Frequency | Hz | Hertz |
| Volume | ml | Milliliters |
| Voltage | V | Volts |
| Current | A | Amperes |
| Resistance | Ω | Ohms |
| Capacitance | F | Farads |
| Inductance | H | Henries |
Base units are chosen based on the industry convention.
---
title: Designing Electronics from Scratch
sidebar_position: 2
---
## Overview
Typically electronics engineers go through the following steps when designing
a new electronic device.
1. Requirements Analysis
2. System Diagramming
3. Schematic Capture
4. PCB Layout
5. Ordering
## Requirements Analysis
This stage is all about making sure you have a clear idea of what the device
should do. Your development and cost preferences are a huge factor here.
1. What should the device do?
2. How much power is needed?
3. How much processing power do I need?
4. Do I want to run linux, MicroPython, or low-level C code? Do I even need
to run code?
5. How much does cost matter?
6. Should I use only parts available from turn-key manufacturers like JLCPCB?
## System Diagramming
In this phase we create a diagram overview of the system and how things connect
together abstractly
1. What components should I use?
2. How do things connect together at a high level?
The system diagram can instantly communicate how your design works to others.
### System Diagram Example 1: Bluetooth Humidity and CO2 Sensor
Here's an example of a system diagram for a simple IoT device that takes
humidity and CO2 measurements and can communicate them via bluetooth.
System Diagram Example 1
## Schematic Capture
In this phase we create a schematic diagram of the system and how things connect
together.
1. Using reference designs, datasheets or pre-made modules, create all the
elements of the circuit in tscircuit
2. Run design checks to make sure the circuit is hooked up correctly
In this phase you should create chip modules or [import third party chips](../guides/importing-modules-and-chips/importing-from-jlcpcb.mdx)
as you build up your circuit. You shouldn't be configuring chips in
the same file that connects all your chips together- give each chip it's own
module.
After the schematics look good, you can export to a readable netlist and upload
the netlist to AI tools like OpenAI O1 to get a review and make sure everything
is connected properly! This is also a good stage to get your schematic reviewed
by your team members.
## PCB Layout
In this phase we create a layout of the circuit on a PCB.
tscircuit automatically autoroutes the circuit for you, but you may still need
to "drag'n'drop" components in the PCB viewer to the locations you want them to
be in. Use [manual editing](../guides/manual-edits.mdx) to drag'n'drop
components on the PCB.
## Ordering
In this phase we order the PCB from a manufacturer. Typically this is done
by downloading [Fabrication Files](../guides/understanding-fabrication-files.md)
and "dragging and dropping" them into a manufacturer's website.
Sometimes you'll want to assemble the PCB yourself (or sometimes just a single
component that your manufacturer doesn't have!). In this case, you'll need a
lab setup to facilitate soldering.
Check out our guide on [Ordering Prototypes](./ordering-prototypes.mdx) to learn more.
---
title: Ordering Prototypes
sidebar_position: 4
---
## Overview
After [you've designed your device](./designing-electronics-from-scratch.md),
you can use [fabrication files](../guides/understanding-fabrication-files.md)
to get your device fully assembled.
The two most popular services for
ordering prototypes are [JLCPCB](https://jlcpcb.com) and [PCBWay](https://pcbway.com).
## Uploading [Fabrication Files](../guides/understanding-fabrication-files.md)
Most fabrication or turn-key assembly services allow you to directly upload 3 types of files:
- Gerbers
- Bill of Materials (BOM CSV)
- Pick'n'Place File (CSV)
These files are all available inside your [Fabrication Files zip file](../guides/understanding-fabrication-files.md) when
you export from tscircuit.
Many fabricators allow you to directly drop fabrication files on their website!
## Assembling your own boards
It can sometimes be easier to assemble your own boards, this gives you more
control over your inventory and can lower the cost of your prototypes since
assembly services often have a minimum order quantity.
Even if you're assembling your own board, you should still order your PCB
from a fabrication service. PCBs require a chemical etching process to do
at home and it's rarely worth the hassle to do it yourself.
When you're assembling your own board, you can create a printout of your
Assembly View to make it easier to place components. In an assembly view,
the "pin1" location is marked with a cut corner. This can help you verify
the orientation of each component as you place it.
---
title: What are electronics made of?
sidebar_position: 1
---
## Overview
In this tutorial, we're going to be talking about the different elements that
make up a Printed Circuit Board (PCB). For each element, we'll show different
ways that the element can be represented in tscircuit.
## What is copper? Why are PCBs green?
Copper is a conductive material that's used on a PCB to make an electrical
connection between chips. A PCB is mostly made up of fiberglass with a small
layer of precisely etched copper. The fiberglass is non-conductive and often
coated with non-conductive green "soldermask" to cover parts of the copper that
aren't meant to be connected to chips.
An AI-generated PCB image. All the yellow parts represent copper, while the green parts represent fiberglass with a green soldermask
A PCB can be thought of as a bunch of "printed" copper separated by fiberglass
sections that "insulate" or don't conduct electricity. We "glue" (solder) chips
to the copper "pads" to add them to the circuit.
## What are PCB layers?
When you print on a piece of paper, you can print "single-sided" or "double-sided",
PCBs can also be printed singled-sided or double-sided! The "front" of the PCB
is called the "top" layer, and the "back" of the PCB is called the "bottom" layer.
We can "print" copper to each of these layers to draw lots of wires and connect
lots of chips. Sometimes a wire needs to "go over"/"go under" another wire
because the wires aren't allowed to cross. When this happens, we can use the
"back" or "bottom layer" of the PCB to draw the wire so that the wires don't
accidentally touch.
## Vias
Vias are holes that connect different layers of PCB. Let's say you have a chip
on the top layer of a PCB and the back layer of a PCB. How can you connect them?
The copper on the top needs some way to "pass through" to the bottom layer.
This is where vias come in. A via is a hole that is "filled with copper" so that
the top layer can pass to the bottom.
Vias connect different layers of a PCB (
)
`} />
## Plated Holes
A plated hole is similar to a via but it's hollow so that you can push metal pins
through it. This is important for chips that have big pins that need to fit into
holes. Chips with big pins that must go through holes are called "through-hole"
chips, and chips with small
pins are called "surface-mount" chips.
(
)
`} />
## Unplated Holes "Regular Holes"
Unplated holes or "regular holes" are just holes in the printed circuit board
without any copper around them. They don't electrically connect anything, but
can be very helpful for mounting the printed circuit board.
(
)
`} />
## Traces
Traces are the wires that connect the components on a PCB. They are made of
copper and mostly covered by green soldermask so that they don't accidentally
conduct to each other if something conductive like a wire or piece of metal falls
across them.
We represent traces in PCB viewers with different colors depending on what
layer they fall on. In tscircuit, traces are always autorouted, so you don't
need to tell it which path to take- it'll automatically find one that makes sure
it doesn't cross any other traces.
Traces allow chips to "talk" to each other and for power to be shared across all
chips.
(
)
`} />
## What are inner layers?
Inner layers are layers of PCB that aren't visible, they're sandwiched on the
inside. Sometimes this is useful when you have a lot of wires to connect and
it's almost impossible to stop them from crossing each other.
Inner layers are layers of PCB that aren't visible, they're sandwiched on the inside. Excellent image from pcbway
---
title: tsci add
---
`tsci add` is the same as `npm add` or `bun add`, but defaults to the tscircuit
registry. If your project has the [tsci `.npmrc`](../web-apis/the-registry-api.md#using-the-tscircuit-npm-registry), you can just do `bun add @tsci/.`
and it has the same effect.
```
> tsci add seveibar/PICO_W
# Added @tsci/seveibar.PICO_W@0.0.1
```
You can then import the module and use it for your board!
(
)
`}
/>
---
title: tsci dev
sidebar_position: 2
---
`tsci dev` runs a web server that lets you see a preview of your electronics
in your web browser.
After you run `tsci dev` you should see a preview of your entrypoint file in
your web browser on https://localhost:3020


---
title: tsci export
---
## Overview
`tsci export` can be used to convert a `tsx` file or `circuit.json` file into
schematic PDFs, fabrication files, gerbers, pick'n'place files, netlists and
many more formats.
---
title: tsci init
---
---
title: tsci login
sidebar_position: 1
---
`tsci login` allows you to login to the tscircuit registry. You don't need to
login to tscircuit to use any tools, but logging in does enable the following
great features:
- Cloud Autorouting (`autorouter="auto-cloud"`)
- Package Management (publishing and automatic bundling)
:::info
You don't need a tscircuit account to download and use other people's packages
:::
`tsci login` will take you to a login page where you'll sign in with Github.
After the login flow you'll have have token on your machine that authenticates
you to publish packages or use the cloud autorouter.
## Logout
To logout again, just run `tsci logout`
## Other Auth Functions
Run `tsci auth --help` to see other auth functions, such as printing your token
for use with the [Registry API](../web-apis/the-registry-api.md)
---
title: Bounties and Sponsorship
---
tscircuit has thousands dollars (USD) of bounties opened every month in over
50 new weekly issues. We also automatically sponsor regular contributors
hundreds of dollars each based on their contributions, which we track with Github's API
in our weekly [contribution-tracker](https://github.com/tscircuit/contribution-tracker)
(resets every Wednesday)
Many people follow the [bounties channel on discord](https://discord.com/channels/1233487248129921135/1301957862762872832) or our [bounty board](https://console.algora.io/org/tscircuit/bounties?status=open)
to find issues to contribute to, but **this is actually the hardest way to get bounties!**
**The easiest way to get bounties and sponsorship is to _actually use tscircuit and try to build a circuit_.** When you
find something confusing or buggy, create an issue. When you create an issue that
gets bountied, you get extra points on the contribution tracker and you become
the best person to fix the issue because you understand it so well! If you
continually do this, you'll find that their are infinite issues to be done!
To be eligible for Github Sponsorship, you must be in a supported country and
have Github Sponsors enabled on your Github profile.
---
title: Getting Started as a Contributor
sidebar_position: 1
---
tscircuit is a great project to contribute to if you're familiar with Typescript
and React.
tscircuit is composed of over 200 repositories, but every project uses [bun](https://bun.sh),
so make sure to install bun before you start contributing.
To contribute to tscircuit, you need to make [Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) from a fork of a repository.
## Before You Start
1. Make sure bun is installed on your system
2. Make sure you've signed up at [tscircuit.com](https://tscircuit.com) and have followed a tutorial in the docs to create a circuit board
## Recommended Contribution Order
We recommend the following order for contributing to tscircuit. Contributing to repositories in this order will make sure you have a good understanding of the tscircuit ecosystem.
If you're not able to find an issue in the repo, ask on discord! Maintainers often forget to create issues even though there are many problems they need solved!
## 1. [tscircuit/schematic-symbols](https://github.com/tscircuit/schematic-symbols)
Difficulty: ⭐ (easy) · [Issues](https://github.com/tscircuit/schematic-symbols/issues) · [Repo](https://github.com/tscircuit/schematic-symbols)
[](https://github.com/tscircuit/schematic-symbols/issues)
This is a large repository of schematic symbols, you can view the [symbols here](https://symbols.tscircuit.com)

We also have a [video tutorial](https://blog.tscircuit.com/i/149495167/help-us-build-the-largest-library-of-schematic-symbols) for contributing to this project!
## 2. [tscircuit/footprinter](https://github.com/tscircuit/footprinter)
Difficulty: ⭐⭐ (medium) · [Issues](https://github.com/tscircuit/footprinter/issues) · [Repo](https://github.com/tscircuit/footprinter)
[](https://github.com/tscircuit/footprinter/issues)
This is a project that generates the "footprint" where a chip is placed on a circuit board from a string.
For example, you might turn the string "quad24" into the image below:

Here's the [video tutorial for contributing to footprinter](https://blog.tscircuit.com/p/learn-how-to-contribute-to-tscircuits)
## 3. [tscircuit/cli](https://github.com/tscircuit/cli)
Difficulty: ⭐⭐ (medium) · [Issues](https://github.com/tscircuit/cli/issues) · [Repo](https://github.com/tscircuit/cli)
[](https://github.com/tscircuit/cli/issues)
This is the main development tool for tscircuit. It provides a local development server and package management. The CLI is what you use when you run `tsci dev` or `tsci init`.
## 4. [tscircuit.com](https://github.com/tscircuit/tscircuit.com)
Difficulty: ⭐⭐ (medium) · [Issues](https://github.com/tscircuit/tscircuit.com/issues) · [Repo](https://github.com/tscircuit/tscircuit.com)
[](https://github.com/tscircuit/tscircuit.com/issues)
This is the main website for tscircuit, it features an editor for circuit boards! You should try it at [tscircuit.com](https://tscircuit.com)!
There are a lot of issues in this repo,
## 5. [circuit-to-svg](https://github.com/tscircuit/circuit-to-svg)
Difficulty: ⭐⭐ (medium) · [Issues](https://github.com/tscircuit/circuit-to-svg/issues) · [Repo](https://github.com/tscircuit/circuit-to-svg)
[](https://github.com/tscircuit/circuit-to-svg/issues)
This is a library that converts [Circuit JSON](https://github.com/tscircuit/circuit-json) into SVG files. We use
this all over the place, including in almost all of our
tests!
## 6. [tscircuit/core](https://github.com/tscircuit/core)
Difficulty: ⭐⭐⭐ (hard) · [Issues](https://github.com/tscircuit/core/issues) · [Repo](https://github.com/tscircuit/core)
[](https://github.com/tscircuit/core/issues)
This is the core library that powers tscircuit. It contains all the logic for converting React components into circuit boards, schematics and PCBs.
The core library is written in Typescript and uses React. It's a great project to contribute to if you want to learn about how tscircuit works under the hood.
Here's a [video tutorial for contributing to core](https://blog.tscircuit.com/p/learn-how-to-contribute-to-tscircuits-core).
---
title: Overview of Projects
sidebar_position: 2
---
| Repo | Description | Open Issues |
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| [tscircuit/core](https://github.com/tscircuit/core) | Core library that powers tscircuit, handles conversion of React components into circuit boards | [](https://github.com/tscircuit/core/issues) |
| [tscircuit/schematic-symbols](https://github.com/tscircuit/schematic-symbols) | Library of schematic symbols used across tscircuit | [](https://github.com/tscircuit/schematic-symbols/issues) |
| [tscircuit/footprinter](https://github.com/tscircuit/footprinter) | Generates PCB footprints from string descriptions | [](https://github.com/tscircuit/footprinter/issues) |
| [tscircuit/circuit-to-svg](https://github.com/tscircuit/circuit-to-svg) | Converts Circuit JSON into SVG files | [](https://github.com/tscircuit/circuit-to-svg/issues) |
| [tscircuit/tscircuit.com](https://github.com/tscircuit/tscircuit.com) | Main website and circuit board editor | [](https://github.com/tscircuit/tscircuit.com/issues) |
| [tscircuit/cli](https://github.com/tscircuit/cli) | Main development tool for tscircuit, provides local development server and package management | [](https://github.com/tscircuit/cli/issues) |
| [tscircuit/runframe](https://github.com/tscircuit/runframe) | React component to preview and run tscircuit circuits | [](https://github.com/tscircuit/runframe/issues) |
| [tscircuit/pcb-viewer](https://github.com/tscircuit/pcb-viewer) | React component for viewing PCBs | [](https://github.com/tscircuit/pcb-viewer/issues) |
| [tscircuit/3d-viewer](https://github.com/tscircuit/3d-viewer) | React component for viewing 3D previews | [](https://github.com/tscircuit/3d-viewer/issues) |
| [tscircuit/easyeda-converter](https://github.com/tscircuit/easyeda-converter) | Command line utility for converting JLCPCB footprints to tscircuit | [](https://github.com/tscircuit/easyeda-converter/issues) |
---
title: The Contributor Handbook
---
We have some important patterns that make contributing to
tscircuit more consistent, we document these in [our handbook repo](https://github.com/tscircuit/handbook).
Here are a couple of really important ones:
1. [Use Yalc](https://github.com/tscircuit/handbook/blob/main/guides/using-yalc.md) - tscircuit uses many repositories so it can be hard to test different repositories interacting.
2. [Code Styles](https://github.com/tscircuit/handbook/blob/main/guides/code.md) - tscircuit has some consistent code patterns we use in every project. This makes the code more universally understood. Definitely note the banned words section!
Read the [full handbook here](https://github.com/tscircuit/handbook).
---
title:
sidebar_position: 1
---
The `` element is a root element that contains all the chips and traces
to create a PCB.
You can think of a `` like a `` element in HTML. Everything
goes in a board!
(
)
`} />
## Board Properties
### Customizing the Size of the Board
Generally you'll use the `width` and `height` properties to define the size of
the board.
### Setting the `autorouter`
Boards or [subcircuits](./subcircuit.mdx) can specify what autorouter should be
used to route any traces within them.
Usually you'll want to use an autorouter preset:
- `autorouter="auto"` - Uses the [platform configuration](../guides/platform-configuration.md). For tscircuit.com this defaults to `sequential-trace`.
- `autorouter="sequential-trace"` - Iterate over each trace and use tscircuit's fast built-in autorouter. This method is fast and deterministic but often fails with over 50 traces.
- `autorouter="auto-local"` - Use the platform configuration, but only route locally (do not make API calls)
- `autorouter="auto-cloud"` - Use the platform configuration for
For complex boards with over 50 traces, you should use `autorouter="auto-cloud"`
to take advantage of tscircuit's cloud autorouters, which internally use the popular
[freerouting](https://github.com/freerouting/freerouting) library.
You can also specify a custom autorouter object to use your own autorouter.
(
)
`} />
Learn more about [the Autorouting API here](../web-apis/autorouting-api.mdx)
### Custom Board Outlines
You can specify a custom outline for your board by passing an `outline` prop.
The PCB you get will have this outline cut out, this is great when you want a
board that's not a rectangle!
(
)
`} />
## Flexible PCBs
:::info
Interested in flexible PCBs? Upvote [this issue on Github](https://github.com/tscircuit/tscircuit/issues/510)!
:::
---
title:
sidebar_position: 3
---
## Overview
A `` stores electrical energy in an electric field. Capacitors are commonly used for filtering, energy storage, and timing circuits. Unlike resistors, capacitors can be polarized (like electrolytic capacitors) or non-polarized (like ceramic capacitors).
A capacitor element has two pins. Polarized capacitors must be placed with correct orientation to avoid damage.
When specifying a capacitor, you'll need to provide a footprint string (like `0402` or `0805`) and capacitance value. Popular capacitor types and sizes can be found at [jlcsearch](https://jlcsearch.tscircuit.com/capacitors/list).
(
)
`}
/>
## Pins
A capacitor has the following pins and aliases:
| Pin # | Aliases (Polarized) | Description |
| ---------- | ------- | ----------- |
| pin1 | pos, anode, left | The positive terminal (required for polarized capacitors) |
| pin2 | neg, cathode, right | The negative terminal (must be connected properly for polarized caps) |
:::warning
For polarized capacitors, you must connect the positive and negative pins correctly. Reversing polarity can cause capacitor failure or even explosion!
:::
## Specifications
Capacitors can be configured with these key properties:
- **capacitance** - The capacitance value specified as a string e.g. `"100nF"` or `"2.2μF"`
- **voltageRating** - Maximum voltage the capacitor can handle e.g. `"25V"`
- **tolerance** - Capacitance tolerance percentage e.g. `"±10%"`
- **temperatureCoefficient** - Temperature stability specification e.g. `"X7R"`
- **equivalentSeriesResistance** - ESR value for critical applications e.g. `"0.5Ω"`
## Automatic Part Selection
Like resistors, tscircuit will automatically select suitable capacitor parts based on your specifications through the [platform parts engine](../guides/platform-configuration.md). For specialized capacitors (e.g., low ESR, high voltage), you may want to specify `supplierPartNumbers` explicitly.
---
title:
sidebar_position: 1
---
The `` is the most common and most powerful built-in tscircuit element.
You can represent virtually any "single-part" electronic component with ``,
it is extremely flexible.
## Simple Chips
Here's an example of typical `` usage. We specify a footprint string and
the pin labels that should be used for the schematic representation.
{
return (
)
}
`} />
## Customizing the Schematic Representation
You can alter how a chip appears on the schematic by using the `schPinArrangement`
, `schPinStyles` and `schWidth` properties.
### `schPinArrangement`
`schPinArrangement` controls the arrangement of the pins on the schematic box
representing the chip. You can use this to group similar pins together e.g. to
group GPIO pins together.
:::note
`schPortArrangement` was renamed to `schPinArrangement` in 2025.
:::
(
)
`}
/>
You can also place pins on the top or bottom of the schematic box.
(
)
`} />
### `schPinStyles`
`schPinStyles` controls the style of the pins on the schematic box
(
)
`} />
### Custom Footprints
Often you will have a chip that you want to carefully specify the position of
each pad, plated hole, silkscreen line or other PCB element. To do this, just
insert a `` component instead of string for the `footprint` prop.
Here's an example of a chip with a custom footprint:
(
}
schPortArrangement={{
leftSide: {
direction: "top-to-bottom",
pins: [1, 3],
},
rightSide: {
direction: "bottom-to-top",
pins: [4, 2],
},
}}
/>
)
`} />
For more information about custom footprints, check out the [ element](./footprint.mdx)
### Internally Connected Pins
Some chips, such as a standard 4 pin pushbutton, have pins that are internally
connected. This can be useful to represent for simulation or to enable omitting
pins from a schematic.
(
)
`} />
:::note
You may not want to do this for power or ground pins on boards where you're
expected to connect the pins specifically externally. For example, if you have
several V5 pins that each need a decoupling capacitor, it would be better to
manage the connections explicitly with traces (perhaps using `maxTraceLength`!)
even if they are internally connected.
:::
### Externally Connected Pins
To indicate that pins should be externally connected, you can use the `externallyConnectedPins` props.
Just like the `internallyConnectedPins` prop, this is an array of arrays of pin labels, where each
sub-array represents a group of pins that should be connected together.
(
)
`} />
## Specifying the Manufacturer Part Number or Supplier Part Numbers
tscircuit will attempt to find matching parts based on the `manufacturerPartNumber`
and `footprint` that was provided. If you know the exact part from your supplier
you'd like to use, you should set the `supplierPartNumbers` property as shown
below:
{
return (
}
cadModel={{
objUrl:
"https://modelcdn.tscircuit.com/easyeda_models/download?uuid=973acf8a660c48b1975f1ba1c890421a&pn=C57759",
rotationOffset: { x: 0, y: 0, z: 0 },
positionOffset: { x: 0, y: 0, z: 0 },
}}
schPinSpacing={0.75}
schPortArrangement={{
leftSide: {
direction: "top-to-bottom",
pins: [1],
},
rightSide: {
direction: "bottom-to-top",
pins: [2],
},
}}
/>
)
}
`}
/>
If you don't specify `supplierPartNumbers`, tscircuit will automatically scan
for in-stock parts and select a chip using vendor APIs in the Cloud API using
the [platform parts engine](../guides/platform-configuration.md)
### Supported Suppliers
The following are the supported supplier keys. The list is [maintained here](https://github.com/tscircuit/props/blob/main/lib/common/layout.ts#L56) and you can [request additional suppliers by creating an issue](https://github.com/tscircuit/props/issues/new?template=Blank+issue&title=Supplier%20Request%3A%20)
Available supplier keys:
- jlcpcb
- digikey
- mouser
- macrofab
- pcbway
- lcsc
You can also insert custom keys for your organization and they will be copied to
the output [Circuit JSON](https://github.com/tscircuit/circuit-json)
## Type-safe Chips: Custom Component Hooks
Component hooks are a great way to improve type safety and simplify the usage
of your component. A component hook is created with the `createUseComponent`
from `tscircuit` and returns a hook that when used, will generate a component
with properties for each pin label.
```tsx
import { createUseComponent, type CommonLayoutProps } from "tscircuit"
interface Props extends CommonLayoutProps {
name: string
}
const pinLabels = {
pin1: "VCC",
pin2: "DISCH",
pin3: "THRES",
pin4: "CTRL",
pin5: "GND",
pin6: "TRIG",
pin7: "OUT",
pin8: "RESET"
} as const
export const A555Timer = (props: Props) => (
)
export const use555Timer = createUseComponent(A555Timer, pinLabels)
```
:::warning
Make sure to have `as const` when you're defining your `pinLabels`, if you're
missing this the types won't work!
:::
When you use Component Hooks, you get better type checking in your component usage
because all the pin labels are now available on the component!
```tsx
import { use555Timer } from "./a555timer"
import { usePowerRegulator } from "./power-regulator"
export default () => {
const U1 = use555Timer("U1")
const M1 = usePowerRegulator("M1")
return (
)
}
```
## Importing Chips from JLCPCB, KiCad or Circuit JSON
There are a lot of ways to import a chip configuration, each with their own
guide! This is often much easier and reliable than configuring a chip yourself.
- [Importing Components from JLCPCB](../guides/importing-modules-and-chips/importing-from-jlcpcb.mdx)
- [Importing Components from KiCad](../guides/importing-modules-and-chips/importing-from-kicad.md)
---
title:
sidebar_position: 7
---
## Overview
A crystal oscillator provides a stable clock signal essential for timing applications and microcontroller operations.
(
)`}
/>
## Properties
| Property | Type | Description | Example |
| ---------------- | --------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------- |
| `frequency` | number or string | The operating frequency of the crystal oscillator. | `16e6` or `"16MHz"` |
| `loadCapacitance`| number or string | The load capacitance required for stable operation. | `18pF` |
| `pinVariant` | PinVariant (optional) | Optional property to select a pin configuration variant if multiple options exist. | `"2pin"` |
---
title:
---
## Overview
Diodes are semiconductor devices that allow current to flow primarily in one direction, making them ideal for rectification, signal clipping, and protection against reverse voltage. They are essential in power supply circuits and for protecting sensitive components from voltage spikes.
(
)
`}
/>
In this example, the diode is placed on a board using the default footprint "smd-diode".
## Properties
| Property | Type | Description | Example |
| ---------------- | -------- | -------------------------------------- | ------- |
| `forwardVoltage` | `number` | The forward voltage drop of the diode. | `0.7V` |
## Pins
Diodes have two pins:
- `pin1`/`anode`/`pos` - The positive terminal where current enters.
- `pin2`/`cathode`/`neg` - The negative terminal where current exits.
---
title:
---
## Overview
Within a `` element you can define PCB elements such as [``](../footprints/platedhole.mdx)
or [``](../footprints/smtpad.mdx).
Here's an example of a chip with a custom footprint:
(
}
schPortArrangement={{
leftSide: {
direction: "top-to-bottom",
pins: [1, 3],
},
rightSide: {
direction: "bottom-to-top",
pins: [4, 2],
},
}}
/>
)
`} />
---
title:
---
## Overview
A group is the basic container element that can contain other elements.
By default, a group doesn't have any effect on the circuit.
(
)
`}
/>
## Moving multiple components via a ``
`` elements can be used to move multiple components at once.
In the example below every schematic symbol inside the `` will be moved
5mm to the right and 3mm up.
```tsx
```
We can similarly use a `` to move multiple PCB elements at once:
```tsx
```
---
title:
---
## Overview
A hole can be used for mounting and doesn't have any conductive properties, for
a hole with a conductive ring of copper see [``](../footprints/platedhole.mdx).
Holes do not have a schematic representation.
Holes can be used inside of a [``](./footprint.mdx) or
as a standalone element.
(
)`}
/>
---
title:
---
## Overview
Light emitting diodes are [diodes](./diode.mdx) that emit light when current
passes through them. They are commonly used as indicators on a circuit board
such as a "power on indicator" or "data transfer in progress indicator".
(
)
`}
/>
## Properties
| Property | Example Value | Description |
| ---------------- | ------------- | ---------------------------------------------------------------- |
| `color` | `red` | The color of the LED. `red` LEDs are most common. |
| `forwardVoltage` | `1.6V` | The voltage drop across the LED when forward current is applied. |
### Common LED Footprints
The following represent the most common footprints for LEDs based on [jlcsearch](https://jlcsearch.tscircuit.com),
you can provide these as the `footprint` property to the `led` element e.g. ``
| Footprint | ~JLCPCB Popularity |
| --------- | ------------------ |
| `led0603` | 37% |
| `led0805` | 23% |
| `led1206` | 10% |
| `led0402` | 4% |
## Automatic Part Selection
LEDs are automatically selected according to their color and footprint using
the [platform parts engine](../guides/platform-configuration.md)
---
title:
---
## Overview
A MOSFET or "metal-oxide-semiconductor field-effect transistor" is a type of transistor that is used to control the flow of current through a circuit.
(
)
`}
/>
## Properties
| Property | Description | Example |
| ------------- | --------------------------------------------------- | ------------- |
| `channelType` | The type of channel the MOSFET has (`n`, `p`) | `"n"` |
| `mosfetMode` | The mode of the MOSFET (`enhancement`, `depletion`) | `"depletion"` |
---
title:
sidebar_position: 6.5
---
## Overview
The `` element represents a bunch of traces that are all connected. You
should use nets for representing power buses such as "V5", "V3_3" and "GND"
When using a ``, you're being less specific than
(
)
`}
/>
## Net Properties
Nets can have properties that will pass onto any PCB trace within them. The
trace properties can be automatically used for autorouting adjustments or to
validate connections (such as validating that a chip is connected to a power
source)
| Property | Description |
| -------- | ----------- |
| `isForPower` | The net is used to deliver power ("V5", "V3_3") |
| `isGround` | The net is used as a ground path |
## Implicit Nets
If you use a net in a [port or net selector](../guides/port-and-net-selectors.md)
e.g. `"net.V5"` and there is not ``, then you
---
title:
---
## Overview
The `` element is used to create a male or female pin header
with configurable spacing and number of pins.
## Example
(
)
`}
/>
## Properties
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| pinCount | number | (required) | Number of pins in the header |
| pitch | number \| string | "2.54mm" | Distance between pins |
| schFacingDirection | "up" \| "down" \| "left" \| "right" | "right" | Direction the header faces in schematic view |
| gender | "male" \| "female" | "male" | Whether the header is male or female |
| showSilkscreenPinLabels | boolean | false | Whether to show pin labels in silkscreen |
| doubleRow | boolean | false | Whether the header has two rows of pins |
| holeDiameter | number \| string | "1mm" | Diameter of the through-hole for each pin |
| platedDiameter | number \| string | "1.7mm" | Diameter of the plated area around each hole |
| pinLabels | string[] | undefined | Labels for each pin |
| facingDirection | "left" \| "right" | "right" | Direction the header is facing |
| x | number | 0 | X position of the component |
| y | number | 0 | Y position of the component |
| rotation | number | 0 | Rotation of the component in degrees |
| id | string | auto-generated | Unique identifier for the component |
---
title:
---
## Overview
A potentiometer is a three-terminal resistor with a sliding or rotating contact
that forms an adjustable voltage divider. You can also attach two terminals to
create a variable resistor.
(
)
`}
/>
## Variants (two or three terminals)
The `` element can be configured with two or three terminals
using the `pinVariant` prop.
| Pin Variant | Description |
| ----------- | ----------- |
| `two_pin` | Two terminals |
| `three_pin` | Three terminals |
(
)
`}
/>
---
title:
---
## Overview
Pushbuttons a common type of switch normally open momentary switch. They are
commonly used as a reset or pairing button.
(
)
`}
/>
## Pins
| Pin | Aliases | Description |
| ------- | -- |----------- |
| `1` | `side1` | One of the left side pins |
| `2` | `side1` | One of the left side pins |
| `3` | `side2` | One of the right side pins |
| `4` | `side2` | One of the right side pins |
:::info
The pins are internally connected, so you only need to connect one of the
left or right pins.
:::
## Example: A small keyboard grid of pushbuttons
(
{grid({
rows: 3,
cols: 3,
}).map((cell) => (
))}
)
`}
/>
---
title:
sidebar_position: 2
---
## Overview
A `` is an extremely common element of electronic designs. It limits
the flow of electricity and is critial to making sure digital signals are
properly "pulled up" or "pulled down" to set their default value as `1` or `0`
A resistor element has two pins and is non-polar, meaning it doesn't matter if
you place it on backwards (it resists electricity identically either way!)
When specifying a resistor, you'll usually want to give it a footprint string
such as `0402` or `0603` to indicate it's size. You can see the most popular
resistor sizes for different power ratings at [jlcsearch](https://jlcsearch.tscircuit.com/resistors/list)
(
)
`}
/>
## Pins
A resistor has the following pins and aliases
| Pin # | Aliases | Description |
| ---------- | ------- | ----------- |
| pin1 | left, pos | The left side pin in normal orientation |
| pin2 | right, neg | The right side pin in normal orientation |
:::note
For convenience, you can use the `pos` and `neg` aliases for the resistor. This
can help to remember which pin is which for the purpose of pulling up or pulling
down a signal, but the resistor is non-polar so `pos`/`neg` are meaningless.
:::
## Tolerances
Resistors can be made to different tolerances. In particular, you might care
about the following resistor characteristics:
- **tolerance** - a percentage given with a string, e.g. `tolerance="5%"`. This specifies how accurate the resistance needs to be
- **powerRating** - a wattage e.g. "5W" indicating how much power can transfer through the resistor for normal operation
- **temperatureOperatingRange** - a string indicating the listed range for the resistor's operating temperature `"-15F-150F"`
## Automatic Part Selection
You generally don't need to specify `supplierPartNumbers` with a resistor, tscircuit
will use the [platform parts engine](../guides/platform-configuration.md) to
automatically search vendors for a part matching your tolerances.
---
title:
---
## Overview
Resonators are common components used to provide a stable frequency reference for
circuits. They are often used in clock circuits or as a timing element.
(
)
`}
/>
---
title:
---
## Overview
A `` is a powerful organizational element in tscircuit that
represents a collection of elements that are tightly coupled. Subcircuits are
often used for a small functional block, such as a voltage regulator.
Within a subcircuit, you can have a custom autorouter or isolated nets from the
larger circuits. You can also re-use reference designators. Your subcircuit is
essentially isolated from other subcircuits.
(
)
`}
/>
## Re-using Reference Designators
Re-using reference designators is typically considered a bad practice, but in
tscircuit reference designators are intelligently prefixed prior to being
written on the silkscreen. This means that you can design your subcircuits
without worrying about whether or not a reference designator has been previously
used.
(
)
`}
/>
## Configuring the Autorouter
Subcircuits can have a custom autorouter configuration. This will be inherited
by any children subcircuits.
To specify a custom autorouter configuration, just set the `autorouter` property
on a `` element.
```tsx
{/* ... */}
```
Specifying custom autorouter settings for subcircuits can be extremely useful
when you have a tricky section of components that have special requirements.
Read more about [the autorouter prop here](./board.mdx#setting-the-autorouter).
---
title:
---
## Overview
A switch is a mechanical device that can be used to connect or disconnect a
circuit.
(
)
`}
/>
## Properties
| Property | Type | Description |
| -------- | -------- | -------- |
| `type` | `"spst"` \| `"spdt"` \| `"dpst"` \| `"dpdt"` | The type of switch |
| `isNormallyClosed` | `boolean` | Whether the switch is normally closed |
## Types of Switches
| Type | Description |
| ---- | ----------- |
| `spst` | Single Pole Single Throw - The simplest switch type with one input and one output |
| `spdt` | Single Pole Double Throw - One input that can be connected to either of two outputs |
| `dpst` | Double Pole Single Throw - Two separate inputs each connecting to their own output |
| `dpdt` | Double Pole Double Throw - Two separate inputs that can each connect to either of two outputs |
(
)
`}
/>
## When to use `` vs ``
You should always use `` or any more specific switch element
when possible. `` is a more generic element with less defaults.
---
title:
sidebar_position: 5
---
## Overview
The `` element represents an electrical connection between two or more points in your circuit. Traces can connect components, nets, or specific pins on components.
## Basic Usage
Here's a simple example connecting two components:
(
)
`} />
## Trace Properties
| Property | Description | Example |
| -------- | ----------- | ------- |
| `from` | Starting point of the trace using a [port selector](../guides/port-and-net-selectors.md) | `".R1 > .pin1"` |
| `to` | Ending point of the trace using a [port selector](../guides/port-and-net-selectors.md) | `".C1 > .pin1"` |
| `maxLength` | Maximum length the trace can be (optional) | `"10mm"` |
| `minLength` | Minimum length the trace must be (optional) | `"5mm"` |
| `width` | Width of the trace (optional) | `"0.2mm"` |
## Connecting to Nets
Traces can connect to named nets like power and ground:
(
)
`} />
## Autorouting
Traces are automatically routed by tscircuit's [autorouting system](./board.mdx#setting-the-autorouter). The autorouter will:
1. Find a path between components that doesn't intersect other traces
2. Use vias to change layers when needed
3. Respect any length constraints specified
4. Try to minimize the number of vias used
You can customize the autorouting behavior by setting the `autorouter` property on the parent [``](./board.mdx) or [``](./subcircuit.mdx).
## Length Constraints
Sometimes you need traces to be exactly a certain length, like for high-speed signals. You can use `maxLength` and `minLength`:
(
)
`} />
## Differential Pairs
For high-speed signals, you often need pairs of traces to have matched lengths. You can use the `differentialPairKey` property to group traces:
:::info
The `differentialPairKey` property is in beta and not available on all autorouters yet!
:::
(
)
`} />
The autorouter will ensure both traces in the pair have the same length.
## Net vs Direct connections
There are generally two ways that traces are represented on a PCB "Rats Nest"
or on a schematic and they have very different results:
- **Net** - A trace that connects a net to a component pin.
- ``
- **Direct** - A trace that connects two component pins directly.
- ``
When you specify a trace with a net, the autorouter will look for the best
place to tie into the net. This means you're not specifying the exact location
where the trace will go.
When using net connections we use a Rats Nest on a PCB view or a net label on a
schematic view. When you see a dotted line on a Rats Nest, you should think of
it as a _possible_ connection point, but not necessarily the final place where
the autorouter will connect to the net.
---
title:
---
## Overview
A transistor is a three-terminal semiconductor device that can amplify or switch electronic signals. It is a fundamental component in many electronic circuits, including amplifiers, oscillators, and digital logic gates.
(
)
`}
/>
There are different types of transistors, so where possible you should use the
most specific element to represent your use case
- [``](./transistor.mdx) - Generic transistor
- [``](./mosfet.mdx) - MOSFET transistor
## Properties
| Property | Description | Example |
| -------- | --------------------------------------------------------------- | ------- |
| `type` | The type of transistor (`npn`, `pnp`, `mosfet`, `igbt`, `jfet`) | `"npn"` |
---
title:
---
## Overview
A via is a plated hole that connects different layers of a PCB. Vias are
commonly used to route traces between layers and for thermal management.
Vias do not have a schematic representation.
You generally do not need to manually create vias, they will be handled
automatically by the [autorouter](./board.mdx#setting-the-autorouter).
(
)`}
/>
## Properties
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| fromLayer | string | "top" | Starting layer for the via |
| toLayer | string | "bottom" | Ending layer for the via |
| holeDiameter | number \| string | "0.4mm" | Diameter of the plated hole |
| outerDiameter | number \| string | "0.8mm" | Outer diameter of the copper annular ring |
| x | number | 0 | PCB X position of the via |
| y | number | 0 | PCB Y position of the via |
---
title:
---
## Overview
The `` element is used to enforce geometric relationships between different elements in a PCB footprint. Constraints can set specific distances and alignments, such as center-to-center, edge-to-edge, or ensuring two elements line up along the same axis.
Below is a reference example that demonstrates how constraints are used within a footprint. This example is part of a test suite to validate that a KeyswitchSocket component is correctly flipped when placed on different layers of a board.
(
{/* */}
}
/>
)
export default () => (
)
`} />
## Key Constraints Summary
- ``: Defines a constraint based on the center positions of two elements.
- ``: Sets a fixed distance between the edges of two elements.
- ``: Ensures that multiple elements share the same Y coordinate.
Use these constraints to help align footprint elements consistently across your designs.
---
title: Footprint Elements vs Strings
sidebar_position: 1
---
When setting the `footprint` property for an element, you can either
use [footprinter strings](./footprinter-strings.mdx) or use the [``](../elements/footprint.mdx)
element and manually specify pad positions.
Footprinter strings are often quicker, more concise, and have the benefit of often
mapping to a 3d model.
(
} pcbX={3} resistance="1k" />
)
`} />
---
title: Footprinter Strings
sidebar_position: 2
---
## Overview
You can quickly specify the footprint and 3d model for any element by setting
the `footprint` property to a string.
import FootprintPreview from "@site/src/components/FootprintPreview"
## dip
Dual in-line package.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `p` | `"2.54mm"` | Pitch. Space between pins |
| `id` | `"1mm"` | Inner diameter (hole diameter) of plated holes |
| `od` | `"1.5mm"`| Outer diameter (copper diameter) of plated holes |
| `w` | `"300mil"` | Distance between columns |
| `wide` | `false` | Wide DIP style (600mil between columns) |
| `narrow` | `true` | Narrow DIP style (300mil between columns) |
## axial
Basic through-hole “axial” resistor or diode footprint.
Examples:
- `axial`
- `axial_p0.1in`
`axial` parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `p` | `"2.54mm"` | Pitch. Space between pins |
| `id` | `"0.7mm"` | Inner diameter (hole diameter) of plated holes |
| `od` | `"1mm"` | Outer diameter (copper diameter) of plated holes |
## 0402
Standard imperial 0402 package. `1.0mm × 0.5mm`
## 0603
Standard imperial 0603 package. `1.6mm × 0.8mm`
## 0805
Standard imperial 0805 package. `2.0mm × 1.2mm`
## 1206
Standard imperial 1206 package. `3.2mm × 1.6mm`
## 1210
Standard imperial 1210 package. `3.2mm × 2.5mm`
## soic
Small Outline Integrated Circuit (SOIC) footprint.
**Parameters:**
| Parameter | Default | Description |
|---------------|------------|-------------------------------------------------------------------------|
| `num_pins` | `8` | Number of pins in the package. |
| `w` | `"5.3mm"` | Overall package width. |
| `p` | `"1.27mm"` | Pin pitch (center-to-center distance between adjacent pins). |
| `pl` | `"1.0mm"` | Pin length. |
| `pw` | `"0.6mm"` | Pin width. |
| `legsoutside` | `false` | If true, positions pins outside the package body; otherwise, pins are inset. |
---
## bga
Ball Grid Array (BGA) footprint.
**Parameters:**
| Parameter | Default | Description |
|-------------|---------------|----------------------------------------------------------------------------------|
| `num_pins` | `64` | Total number of solder balls. |
| `grid` | _calculated_ | Grid dimensions as an object (e.g. `{ x: N, y: N }`). If unspecified, a square grid is assumed. |
| `p` | `"0.8mm"` | Ball pitch: center-to-center distance between adjacent balls. |
| `w` | _none_ | Package width (optional). |
| `h` | _none_ | Package height (optional). |
| `ball` | _none_ | Ball diameter (optional). |
| `pad` | _none_ | Pad size for each ball (optional). |
| `tlorigin` | `false` | Use top-left numbering for balls. |
| `blorigin` | `false` | Use bottom-left numbering for balls. |
| `trorigin` | `false` | Use top-right numbering for balls. |
| `brorigin` | `false` | Use bottom-right numbering for balls. |
| `missing` | `[]` | List of balls to omit (by number or position) to accommodate design needs. |
## tssop
Thin-Shrink Small Outline Package (TSSOP) footprint. Default configuration is 6.1mm width with 0.65mm pitch.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `8` | Number of pins in the package |
| `w` | `"6.1mm"` | Overall package width |
| `p` | `"0.65mm"` | Pin pitch (center-to-center distance between adjacent pins) |
| `pw` | _calculated_ | Pin width (calculated from pitch if not specified) |
| `pl` | _calculated_ | Pin length (calculated from pin width if not specified) |
## stampboard
A breakout board with configurable pins on all sides. Can include inner holes for mounting.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `w` | `"22.58mm"` | Board width |
| `h` | _calculated_ | Board height (calculated from number of pins if not specified) |
| `left` | `20` | Number of pins on left side |
| `right` | `20` | Number of pins on right side |
| `top` | `2` | Number of pins on top side |
| `bottom` | `2` | Number of pins on bottom side |
| `p` | `"2.54mm"` | Pin pitch |
| `pw` | `"1.6mm"` | Pin width |
| `pl` | `"2.4mm"` | Pin length |
| `innerhole` | `false` | Whether to include inner mounting holes |
| `innerholeedgedistance` | `"1.61mm"` | Distance of inner holes from edge |
## stampreceiver
Similar to stampboard but with modified pad dimensions for receiving a stampboard component.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `w` | `"22.58mm"` | Board width |
| `h` | _calculated_ | Board height (calculated from number of pins if not specified) |
| `left` | `20` | Number of pins on left side |
| `right` | `20` | Number of pins on right side |
| `top` | `2` | Number of pins on top side |
| `bottom` | `2` | Number of pins on bottom side |
| `p` | `"2.54mm"` | Pin pitch |
| `pw` | `"1.6mm"` | Pin width |
| `pl` | `"3.2mm"` | Pin length |
| `innerhole` | `false` | Whether to include inner mounting holes |
| `innerholeedgedistance` | `"1.61mm"` | Distance of inner holes from edge |
## hc49
Standard HC49 crystal footprint.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `p` | `"4.88mm"` | Pin pitch |
| `id` | `"0.6mm"` | Inner diameter of plated holes |
| `od` | `"1.2mm"` | Outer diameter of plated holes |
| `w` | `"5.6mm"` | Package width |
| `h` | `"3.5mm"` | Package height |
## to92
TO-92 transistor package footprint, available in triangular or inline arrangements.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `p` | `"1.27mm"` | Pin pitch |
| `id` | `"0.72mm"` | Inner diameter of plated holes |
| `od` | `"0.95mm"` | Outer diameter of plated holes |
| `w` | `"4.5mm"` | Package width |
| `h` | `"4.5mm"` | Package height |
| `arrangement` | `"triangular"` | Pin arrangement, either "triangular" or "inline" |
## to220
TO-220 package footprint with configurable number of pins.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `3` | Number of pins (specify using format "to220_N") |
| `p` | `"5.0mm"` | Pin pitch |
| `id` | `"1.0mm"` | Inner diameter of plated holes |
| `od` | `"1.9mm"` | Outer diameter of plated holes |
| `w` | `"13mm"` | Package width |
| `h` | `"7mm"` | Package height |
## ssop
Shrink Small Outline Package (SSOP) footprint.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `8` | Number of pins in the package |
| `w` | `"3.9mm"` | Overall package width |
| `p` | `"1.27mm"` | Pin pitch (center-to-center distance between adjacent pins) |
| `pw` | _calculated_ | Pin width (calculated from pitch if not specified) |
| `pl` | _calculated_ | Pin length (calculated from pin width if not specified) |
## sop8
8-pin Small Outline Package (SOP) footprint.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `8` | Fixed at 8 pins |
| `w` | _inherited_ | Overall package width |
| `p` | _inherited_ | Pin pitch |
| `pl` | `"1.5mm"` | Pin length |
| `pw` | `"0.6mm"` | Pin width |
## qfp
Quad Flat Package (QFP) footprint with configurable number of pins.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `32` | Total number of pins (must be divisible by 4) |
| `body_size` | `"7mm"` | Size of the package body (square) |
| `p` | `"0.8mm"` | Pin pitch (center-to-center distance between adjacent pins) |
| `pw` | `"0.25mm"` | Pin width |
| `pl` | `"0.6mm"` | Pin length (exposed pad length) |
## qfn
Quad Flat No-Lead (QFN) package footprint with configurable number of pins.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `20` | Total number of pins (must be divisible by 4) |
| `body_size` | `"4mm"` | Size of the package body (square) |
| `p` | `"0.5mm"` | Pin pitch (center-to-center distance between adjacent pins) |
| `pw` | `"0.25mm"` | Pin width |
| `pl` | `"0.4mm"` | Pin length (exposed pad length) |
## sot23
Small Outline Transistor (SOT-23) footprint with 3 pins.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `3` | Fixed at 3 pins |
| `body_size` | `"2.9mm"` | Size of the package body |
| `p` | `"0.95mm"` | Pin pitch |
| `pw` | `"0.4mm"` | Pin width |
| `pl` | `"0.6mm"` | Pin length |
## sot23_5
Small Outline Transistor (SOT-23-5) footprint with 5 pins.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `5` | Fixed at 5 pins |
| `body_size` | `"2.9mm"` | Size of the package body |
| `p` | `"0.95mm"` | Pin pitch |
| `pw` | `"0.4mm"` | Pin width |
| `pl` | `"0.6mm"` | Pin length |
## sot223
Small Outline Transistor (SOT-223) footprint with 4 pins.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | `4` | Fixed at 4 pins |
| `body_size` | `"6.5mm"` | Size of the package body |
| `p` | `"2.3mm"` | Pin pitch |
| `pw` | `"0.7mm"` | Pin width |
| `pl` | `"0.8mm"` | Pin length |
## pinrow
Row of pins suitable for male or female pin headers. If `_male` or `_female`
is specified the 3d model will update accordingly.
Parameters:
| Parameter | Default | Description |
|-----------|---------|-------------|
| `num_pins` | | Number of pins |
| `p` | `"2.3mm"` | Pin pitch |
| `id` | `"1mm"` | Inner diameter |
| `od` | `"1.5mm"` | Outer diameter |
| `male` | `true` | Male header |
| `female` | `false` | Female header |
---
title:
---
## Overview
The `` element is used to represent a plated through hole on a PCB.
(
} />
)
`}
/>
## Plated Hole Shapes
There are 3 types of plated holes:
- `circle` - A circular plated hole
- `oval` - An oval plated hole
- `pill` - A pill-shaped plated hole (rounded rectangle)
Each shape has different properties
## Properties
| Property | Shape | Description |
| ------------- | ---------- | ---------------------------------------------- |
| holeDiameter | circle | The diameter of the inner hole |
| outerDiameter | circle | The diameter of the outer copper pad |
| innerWidth | oval, pill | The width of the inner hole |
| innerHeight | oval, pill | The height of the inner hole |
| outerWidth | oval, pill | The width of the outer copper pad |
| outerHeight | oval, pill | The height of the outer copper pad |
| portHints | all | Array of port names that this hole connects to |
| pcbX | all | X position of the hole center on the PCB |
| pcbY | all | Y position of the hole center on the PCB |
| name | all | Optional name identifier for the plated hole |
---
title:
---
## Overview
Silkscreen circles are often used to indicate "pin1" on a chip.
(
)
`} />
---
title:
---
## Overview
The `` element creates a line on the silkscreen layer within a footprint.
(
)
`}
/>
## Properties
| Property | Description |
|----------|----------------------------------------------------|
| `x1` | X coordinate of the starting point |
| `y1` | Y coordinate of the starting point |
| `x2` | X coordinate of the ending point |
| `y2` | Y coordinate of the ending point |
| `strokeWidth` | Stroke width of the line |
Feel free to experiment with different coordinate values to see how the silkscreen line is rendered.
---
title:
---
## Overview
The `` element is used to define a custom drawn path on the silkscreen layer.
It supports the following properties:
- route: an array of coordinate objects (each with x and y) that define the path.
- strokeWidth: defines the width of the path's stroke.
(
} pcbX={-15} />
)
`}
/>
## Properties
| Property | Type | Description |
| ----------- | ------ | -------------------------------------------------------------------- |
| route | Array | An array of objects containing x and y coordinates to define a path. |
| strokeWidth | String | The width of the drawn path. |
Feel free to experiment with different routes and strokeWidth values.
---
title:
---
## Overview
Silkscreen rectangles can be used to encapsulate a rectangular area around a
chip
(
)
`} />
---
title:
---
## Overview
The `` element is used to add text to the silkscreen layer within a PCB footprint.
(
)`}
/>
## Properties
| Property | Type | Description |
|-----------------|--------|---------------------------------------------------------------------------------------------------------------|
| `text` | string | The text string to display. |
| `anchorAlignment` | enum | Alignment of the text. One of "center", "top_left", "top_right", "bottom_left", "bottom_right". Defaults to "center". |
| `font` | enum | Optional. The font type, e.g. `"tscircuit2024"`. |
| `fontSize` | length | Optional. The size of the font. |
---
title:
---
## Overview
The `` element is used to represent a surface mount pad.
(
} />
)
`}
/>
## SMT Pad Shapes
There are 3 main types of smtpads:
- `rect` - A rectangular pad
- `circle` - A circular pad
- `pill` - A pill-shaped pad
Each smtpad shape has different properties
## Properties
| Property | Shape | Description |
| ----------- | ------------ | -------------------------------------------------------------- |
| width | rect, pill | The width of the pad |
| height | rect, pill | The height of the pad |
| radius | circle, pill | The radius of the pad (for circle) or corner radius (for pill) |
| ccwRotation | rect | Counter-clockwise rotation angle in degrees |
| portHints | all | Array of port names that this pad connects to |
| pcbX | all | X position of the pad center on the PCB |
| pcbY | all | Y position of the pad center on the PCB |
| layer | all | Which layer the pad is on ("top" or "bottom") |
---
title: Importing from Circuit JSON
---
## Overview
You can import [Circuit JSON](https://github.com/tscircuit/circuit-json) into
tscircuit components.
Circuit JSON is normally an output of tscircuit code, but sometimes it can
be a helpful intermediate format so is used to generate tscircuit code.
## via Web
:::note
TODO we're still writing this section!
:::
## via CLI
:::note
TODO we're still writing this section!
:::
## Programmatically Converting Circuit JSON to tscircuit code
You can use the [circuit-json-to-tscircuit](https://github.com/tscircuit/circuit-json-to-tscircuit)
module to programmatically convert circuit json into tscircuit code.
---
title: Importing from JLCPCB
sidebar_position: 2
---
## Overview
JLCPCB has a massive component catalog of 3d models and footprints.
## Web Import
You can import JLCPCB components on [tscircuit.com](https://tscircuit.com). After
importing the snippet, it'll be given a package name like `@tsci/YOUR_NAME.CHIP_NAME`
and available for import from the tscircuit registry.
Step 1: Go to `tscircuit.com` and press the "new" buttonStep 2: Click "Import JLCPCB Component"Step 3: Paste in the JLCPCB Part NumberYou can find the JLCPCB Part Number on JLCPCB's websiteAn example of an imported JLCPCB component
After your component has been added to tscircuit, you can import it as a
`@tsci/*` import like this:
```tsx
import { ESP32_WROOM_32DC } from "@tsci/AnasSarkiz.ESP32_WROOM_32DC"
export default () => (
)
```
## CLI Import
To import using the CLI, run `npm install -g easyeda`. This will give you the
`easyeda` command line tool. You can then run `easyeda convert` as shown below
```
# Convert a schematic and footprint for JLCPCB part number C46749 (NE555)
# to tscircuit component
easyeda convert -i C46749 -o C46749.tsx
easyeda convert -i C46749 -t tsx
```
This will create a `tsx` file that you can import.
---
title: Importing from KiCad
sidebar_position: 3
---
## Overview
You can import KiCad components or projects into tscircuit.
To import from KiCad, you should understand the different file formats KiCad
uses:
- Files for KiCad components
- `kicad_mod` - PCB footprint file for a single component
- `kicad_sym` - Schematic symbol file for a single component
- Files for KiCad projects
- `kicad_pro` - KiCad project file
- `kicad_pcb` - KiCad PCB board file
- `kicad_sch` - KiCad Schematic board file
:::info
We're still building KiCad import directly into tscircuit.com, stay tuned for
when that's available!
:::
## Importing KiCad Components
Currently the easiest way to import KiCad components is to go to [kicad-component.tscircuit.com](https://kicad-component.tscircuit.com/)
and upload your `kicad_mod` and/or `kicad_sym` file.
### Importing KiCad Components using the CLI
Using tscircuit's [open-source KiCad component converter](https://github.com/tscircuit/kicad-component-converter),
we can convert KiCad files on the command line.
First install the component converter:
```bash
npm install -g kicad-mod-converter
```
Next, run the following command to convert your KiCad files:
```bash
# Convert a directory ./my-footprints.pretty to a tscircuit project
kicad-mod-converter convert-kicad-directory --input-dir ./my-footprints.pretty --output-dir ./my-tscircuit-footprints
```
### Importing KiCad Components Programmatically
```bash
bun add kicad-mod-converter
```
```tsx
import { parseKicadModToCircuitJson } from "kicad-component-converter"
import { readFileSync } from "node:fs"
const fileContent = readFileSync("SW_SP3T_PCM13.kicad_mod")
const circuitJson = await parseKicadModToCircuitJson(fileContent)
/* [
* {
* "type": "pcb_smtpad",
* "x": 0.345,
* ...
*/
```
[Circuit JSON](https://github.com/tscircuit/circuit-json) can then be converted
into regular tscircuit modules using [circuit-json-to-tscircuit](https://github.com/tscircuit/circuit-json-to-tscircuit)
---
title: Automatic Layout
---
:::warning
Automatic layout is in beta! We're changing and improving the layout algorithms,
if it doesn't work for you stay tuned! Many changes are on the way!
:::
You can automatically lay out schematics and PCBs using the `schAutoLayoutEnabled` and
`pcbAutoLayoutEnabled` props.
## Automatic Schematic Layout
Here's an example of a Pico-driven nine key keyboard with `schAutoLayoutEnabled`:
(
{grid({ sizeX: 3, sizeY: 3, pitch: 19.05, offset: { x: 20, y: 0 } }).map(
({ x, y, row, col }, index) => {
const schOffX = 5 + x/6
const schOffY = -y / 8
return (
)
}
)}
)
function grid(opts: {
sizeX: number
sizeY: number
pitch: number
offset?: { x: number; y: number }
}): Array<{ x: number; y: number; row: number; col: number }> {
const { sizeX, sizeY, pitch, offset = { x: 0, y: 0 } } = opts
const points: Array<{ x: number; y: number; row: number; col: number }> = []
const startX = (-(sizeX - 1) * pitch) / 2
const startY = (-(sizeY - 1) * pitch) / 2
for (let row = 0; row < sizeY; row++) {
for (let col = 0; col < sizeX; col++) {
points.push({
x: startX + col * pitch + offset.x,
y: startY + row * pitch + offset.y,
row,
col,
})
}
}
return points
}
`}
/>
## Automatic PCB Layout
:::warning
PCB Autolayout is not currently available but coming soon! If you're interested
in PCB Autolayout you should [upvote this issue on GitHub](https://github.com/tscircuit/tscircuit/issues/511)
:::
---
title: Configuring Chips
sidebar_position: 1.5
---
import ChipPage from "../elements/chip.mdx"
---
title: Displaying Circuit JSON on a Webpage
---
[Circuit JSON](https://github.com/tscircuit/circuit-json) is a universal
intermediary format for representing an electronic circuit. It contains PCB,
Schematic, 3D, Bill of Materials and simulation information.
tscircuit code always converts into Circuit JSON, which can be displayed in
any of our React components
:::tip
You can also upload your Circuit JSON to [circuitjson.com](https://circuitjson.com)
for a quick preview!
:::

## React: Display all available previews with ``
The `` component is a simple way to display all available
previews for a Circuit JSON array. You can use it by installing the `@tscircuit/runframe`
package and importing it into your `React` project.
```tsx
import { CircuitJsonPreview } from "@tscircuit/runframe"
import { renderToCircuitJson } from "lib/dev/render-to-circuit-json"
export default () => (
,
)}
/>
)
```
You should see something like this:

For more examples and usage, check out the [runframe repo](https://github.com/tscircuit/runframe)
and the [examples directory](https://github.com/tscircuit/runframe/tree/main/examples)!
:::info
Have tscircuit code and want to skip converting to Circuit JSON? Try using the
`` component directly to build your circuit in the browser!
:::
### React: Running tscircuit code in the browser (no Circuit JSON needed!)
The `` component is a simple way to run tscircuit code in the browser.
RunFrame loads the tscircuit runtime (and all the dependencies to build Typescript
code) into a WebWorker and runs the code in the background.
To use RunFrame, you must provide a `fsMap` object. This object maps file paths
to file contents. Files inside this "filesystem map" can import each other, this
is super useful when you have many files to import such as a `manual-edits.json`
file!
```tsx
import { RunFrame } from "@tscircuit/runframe"
export default () => (
)
`,
}}
entrypoint="main.tsx"
/>
)
```
You can see different examples of how RunFrame looks for different circuits
on the [RunFrame online examples page](https://runframe.vercel.app/)
`` automatically handles imports from the tscircuit registry
## Displaying Circuit JSON without React
Are you interested in this? Please [upvote this issue](https://github.com/tscircuit/tscircuit/issues/508)
so we can prioritize it!
---
title: Essential Elements
sidebar_position: 1
---
## Overview
There are some essential elements you'll need for almost every circuit you make,
this doc gives a brief overview of each of them so you can jump right in and
get started building electronics!
| Element | Description |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [``](../elements/board.mdx) | The root element of a circuit, defines the size of the board and settings like the autorouting method that should be used |
| [``](../elements/chip.mdx) | A packaged integrated circuit (IC). |
| [``](../elements/trace.mdx) | Represents a connection between different chips. |
| [``](../elements/led.mdx) | Light emitting diode, a small light often used to represent power or status indicators |
| [``](../elements/resistor.mdx) | Resists the flow of electrical current. |
| [``](../elements/capacitor.mdx) | Stores electrical charge. Often used to smooth out voltage fluctuations. |
| [``](../elements/diode.mdx) | Allows current to flow in one direction. |
## The Essential Elements
### [``](../elements/board.mdx)
The `` element is the root container for your circuit, similar to how `` works in HTML. Every circuit needs a board! You can customize the size using `width` and `height` props, or even create custom board outlines for non-rectangular shapes.
(
)`
} />
### [``](../elements/chip.mdx)
The `` element is the most versatile component in tscircuit - it can represent virtually any packaged electronic component. You specify a footprint and pin labels, and can customize how it appears in both schematic and PCB views. Here's a simple example:
(
)`} />
You can control pin arrangements, add custom footprints, specify internally connected pins, and more. The `` element is commonly used for ICs, connectors, buttons, and other discrete components.
---
title: Using Layout Properties
---
## Overview
There are many ways to layout your schematic and PCB with tscircuit including
[automatic layout](./automatic-layout.mdx) and [manual edits](./manual-edits.mdx). In this
article we'll discuss how to programmatically lay out a board using layout properties like
`schX`/`schY` and `pcbX` and `pcbY`
All position properties default to `mm` but you can pass a string with any distance
unit. For example, `pcbX="0.1in"` is the same as `pcbX="2.54mm"`.
## PCB Layout Properties
The following properties can be placed on nearly any tscircuit element to control
its position on the board:
| Property | Description | Example Value |
| -------- | ----------- | ------------- |
| `pcbX` | Set the center X position of the element | `0` |
| `pcbY` | Set the center Y position of the element | `0` |
| `pcbRotation` | Set the rotation of the element | `"90deg"` |
Here's an example of moving a resistor with default properties versus custom
layout properties:
(
)
`} />
(
)
`} />
:::info
To see positions and measure distances in the PCB Viewer, you can press "d" on
your keyboard to toggle measurement mode.
PCB Viewer Measurement Mode, press "d" to toggle when using the PCB tool
:::
## Schematic Layout Properties
The following properties can be placed on a schematic element to control its position on the board:
| Property | Description | Example Value |
| -------- | ----------- | ------------- |
| `schX` | Set the center X position of the element | `0` |
| `schY` | Set the center Y position of the element | `0` |
| `schRotation` | Set the rotation of the element | `"90deg"` |
Here's an example of moving a resistor with default properties versus custom
schematic layout properties:
(
)
`} />
(
)
`} />
---
title: Manual Edits
---
It can be cumbersome to programmatically define the locations of every component
on the PCB and schematic, but [automatic layout](./automatic-layout.mdx) can
be too uncontrolled. Manual edits allow you to use a schematic or PCB viewer
to drag and drop components.
:::info
Are you trying to programmatically define the locations of components? Check out
[using layout properties](./layout-properties.mdx) instead.
:::
Every time you drag a component, a file conventionally called `manual-edits.json`
is edited with your edits. This manual edits file is imported and can be given
as the `manualEdits` prop to a `` or ``
## Creating Manual Edits with a GUI
Each GUI features an "edit button" to turn on an editing mode. After you turn
on the editing mode, you can drag and drop components and your edits will
automatically edit the `manual-edits.json` file.
### Creating Manual Edits in the Schematic Viewer
In the top-right corner there is a pencil edit button. This turns on the edit
mode.
:::note
TODO insert a video here showing the manual edits in action!
:::
### Creating Manual Edits in the PCB Viewer
The PCB Viewer features two edits modes:
- Edit Trace Mode
- Move Components Mode
You can find both of them by hovering over the PCB viewer.
:::note
TODO insert a video here showing the manual edits in action!
:::
### Troubleshooting manual edits not being applied
Usually if manual edits aren't being applied, it's because you haven't imported
the `manual-edits.json` file. On the [tscircuit.com editor](https://tscircuit.com),
you'll get a warning that automatically edits your code to insert the import.
If you're editing locally, add the following lines:
```tsx
import manualEdits from "./manual-edits.json"
export default () => (
// VVVV add this prop!
{/* ... */}
)
```
If you're still not seeing your manual edits, select the `manual-edits.json`
file from the tscircuit editor or find the file on your filesystem. Make sure
that it changes when you drag'n'drop components.
## The Manual Edits Format
The manual edits file's format is defined in [this typescript file](https://github.com/tscircuit/props/blob/main/lib/manual-edits/manual_edits_file.ts), it contains 3 main types of edits:
- **pcb_placements** - Component positions on the PCB
- **manual_trace_hints** - "Hints" indicating where PCB traces should go
- **schematic_placements** - Component positions on the schematic
Here's an example of a manual edits file:
```json
{
pcb_placements: [
{
"selector": "R1",
"center": {
"x": 0,
"y": 6.869495369849336
},
"relative_to": "group_center",
"_edit_event_id": "0.037205222437411756"
}
]
manual_trace_hints: []
schematic_placements: [
{
selector: "R1",
center: { x: 5, y: 5 },
relative_to: "group_center",
},
{
selector: "C1",
center: { x: -5, y: -5 },
relative_to: "group_center",
},
]
}
```
---
title: Platform Configuration
---
## Overview
The Platform Configuration allows you to change tscircuit behavior to best suite
the platform the tscircuit code is running on.
Some use cases:
- Organizations may want to customize the cloud-autorouter to avoid sending sensitive designs outside your company
- Organizations may want to use their own internal registry for importing circuits instead of [tscircuit.com](https://tscircuit.com)
- For [autorouting.com](https://autorouting.com), we configure the platform to not perform any autorouting
## Customizing the Platform
All of the following features of the platform can be configured:
- **partsEngine** - The engine used to automatically find parts matching component specifications
- **registryApiUrl** - The registry to use, defaults to `https://registry-api.tscircuit.com`. See [Registry API](../web-apis/the-registry-api.md) for more details
- **cloudAutorouterUrl** - The cloud autorouter to use, defaults to a tscircuit cloud service that uses freerouting
- Disable specific circuit outputs to optimize build times, such as disabling autorouting
### The Default Platform
The tscircuit default platform configuration sources parts from multiple vendors
and uses the tscircuit backend for autorouting and `@tsci/*` imports.
Current vendors used for automatic part sourcing:
- [JLCPCB](https://jlcpcb.com)
- Digikey (coming soon!)
- Mouser (coming soon!)
For each vendor, tscircuit populates multiple available chips. This means even
if tscircuit finds parts for a vendor, you don't have to use that vendor!
## Using your Platform
:::info
Want more platform features? Tell us about your use case in [this GitHub Discussion!](https://github.com/orgs/tscircuit/discussions/514)
:::
When you initialize a `RootCircuit`, you can provide the platform configuration
as the `{ platform }` parameter:
```tsx
import { RootCircuit } from "@tscircuit/core"
const circuit = new RootCircuit({
platform: {
registryApiUrl: "https://my-tscircuit-registry.mycompany.com",
},
})
```
This can also be provided to modules like `@tscircuit/eval` to evaluate tscircuit
code:
```tsx
import { CircuitRunner } from "@tscircuit/eval-webworker"
import myPartsEngine from "./my-parts-engine"
const circuitRunner = new CircuitRunner({
platform: {
partsEngine: getMyPartsEngine,
},
})
await circuitRunner.execute(`
circuit.add(
)`)
await circuitRunner.renderUntilSettled()
const circuitJson = await circuitRunner.getCircuitJson()
```
:::info
Interested in running the entire tscircuit platform privately inside your company?
We're happy to help! Reach out to **enterprise@tscircuit.com**
:::
---
title: Port and Net Selectors
---
Selectors are a string used to reference a port, net or any component. They're most
commonly used in traces like this:
```tsx
```
However they can also be used anywhere where a port is referenced, for example to indicate what a capacitor should decouple or a resistor should pullup to:
```tsx
```
Selectors use the same semantics as CSS selectors:
- `>` means "direct child"
- `.` means "name" (in CSS, this can be any class name, but in tscircuit components are limited to a single name)
- `.U1` means "something with the name `U1`"
- `net.GND` means "a net with the name `GND`"
## Selectors don't cross subcircuit boundaries unless told to
When a selector is specified, it's resolved relative to the
subcircuit of the component where it's specified.
This means within a subcircuit the selector `.U1` will match any component with the name `U1` anywhere in that subcircuit without going into other subcircuits.
Subcircuits can be nested and have names, so you can use this
to reference components in nested subcircuits:
```tsx
{/* We must include ".S1" in the selector to select the resistor from the inner subcircuit */}
```
Because subcircuits are isolated from each other, you can
re-use reference designators in different subcircuits (globally
unique reference designators are generated on export)
---
title: Programmatically Building Circuits
---
This guide is about using tscircuit inside of scripts, APIs or inside the browser. Maybe you want to create a website that allows your users drag'n'drop to create custom electronics and turn their designs into real circuits automatically.
For most users, there is no need to programmatically build circuits, you can use the [command line](../command-line/tsci-dev.md) or the [online editor](../intro/quickstart-web.md) to build and export your circuits into any supported format.
If you're not using Typescript or prefer a "zero-installation" setup, you can fully build your circuits with complex parameters using the [Registry API](../web-apis/the-registry-api.md)
## Using `@tscircuit/core` directly
`@tscircuit/core` is the core library for tscircuit, it converts React code into [Circuit JSON](https://github.com/tscircuit/circuit-json), a universally intermediary format that represents an electronic device.
Here's an example of how to use `@tscircuit/core` directly to build a circuit into Circuit JSON:
```tsx
import { RootCircuit } from "@tscircuit/core"
const circuit = new RootCircuit()
circuit.add(
)
await circuit.renderUntilSettled()
console.log(circuit.getCircuitJson())
```
This will output a long [Circuit JSON](https://github.com/tscircuit/circuit-json) array that you can convert into many
other formats or display directly inside a [CircuitJsonPreview](./displaying-circuit-json-on-a-webpage.mdx) component.
## Evaluating Typescript Circuits
`@tscircuit/eval` can be used to evaluate Typescript/React code and
automatically import modules from the tscircuit registry.
```tsx
import { CircuitRunner } from "@tscircuit/eval"
const circuitRunner = new CircuitRunner()
await circuitRunner.execute(`
import { RedLed } from "@tsci/seveibar.red-led"
circuit.add(
)`)
await circuitRunner.renderUntilSettled()
const circuitJson = await circuitRunner.getCircuitJson()
// Display or convert the circuit json to any other format!
```
### Evaluating tscircuit inside a web worker
```tsx
import { createCircuitWebWorker } from "@tscircuit/eval/webworker"
const circuitWebWorker = createCircuitWebWorker()
await circuitWebWorker.execute(`
import { RedLed } from "@tsci/seveibar.red-led"
circuit.add(
)
`)
await circuitWebWorker.renderUntilSettled()
const circuitJson = await circuitWebWorker.getCircuitJson()
```
## Converting Circuit JSON to other formats
You can convert [Circuit JSON](https://github.com/tscircuit/circuit-json) to many
other formats:
- [Gerber files](https://github.com/tscircuit/circuit-json-to-gerber)
- [Specctra DSN Autorouting files](https://github.com/tscircuit/dsn-converter)
- [Pick'n'Place Files](https://github.com/tscircuit/circuit-json-to-pnp-csv)
- [PCB and Schematic SVGs](https://github.com/tscircuit/circuit-to-svg)
- [Bill of Materials](https://github.com/tscircuit/circuit-json-to-bom-csv)
- [SPICE netlists and simulations](https://github.com/tscircuit/circuit-json-to-spice)
---
title: Publishing Modules
sidebar_position: 6
---
---
title: Running tscircuit inside an iframe
---
## Overview
tscircuit can be evaluated inside an iframe. This makes it easy to embed
snippets on a webpage without complex build systems.
Here's an example of an iframe running a tscircuit snippet:
import { TscircuitIframe } from "../../src/components/TscircuitIframe"
)`,
}}
entrypoint="main.tsx"
/>
## Running tscircuit inside an iframe
To run tscircuit inside an iframe, perform the following steps:
1. Add an iframe that points to `"https://runframe.tscircuit.com/iframe.html"`
2. Listen for the `runframe_ready_to_receive` message from the iframe
3. Send the code you want to run to the iframe via `postMessage`
Here's a fully working example:
```html
RunFrame Host
```
## React iframe wrapper for tscircuit
An iframe wrapper is available to simplify the process of running tscircuit
inside an iframe. To use it, add the `@tscircuit/runframe` package to your
project and use the [`RunFrameWithIframe` component](https://github.com/tscircuit/runframe/blob/main/lib/components/RunFrameWithIframe/RunFrameWithIframe.tsx) like so:
```tsx
import { RunFrameWithIframe } from "@tscircuit/runframe/iframe"
export default () => (
)`,
}}
entrypoint="main.tsx"
/>
)
```
---
title: Understanding Fabrication Files
---
## Overview
Fabrication files are files that can be uploaded to a fabricator or turn-key
manufacturer to get an entire circuit board made. tscircuit includes three
main types of files inside our fabrication files `zip`:
- **Gerbers** These represent each copper layer of the PCB. We also include
drilling holes and board cutouts
- **Bill Of Materials CSV**
- **Pick'n'Place CSV** These
## How to get fabrication files
### Web
On the web, you can just hit "Download" on any circuit, then hit "Fabrication Files"
Downloading fabrication files from the online editor
### CLI
You can run [tsci export ./main.tsx --to fabrication-zip](../command-line/tsci-export) to export to a fabrication files zip file containing Gerbers, Bill of Materials and
the Pick'n'Place CSV.
## Uploading Fabrication Files
Many fabricators allow you to directly drop fabrication files on their website!
---
title: Using "sel" References
---
The `sel` object is a special import that allows you to easily reference
components with a bit more type-safety than a string. It can also be more ergonomic
than typing out a [port selector](./port-and-net-selectors.md).
(
)
`} />
The `sel` can be thought of as a very large mapping of conventional strings.
Here are some `sel` expressions and their corresponding string:
```tsx
import { sel } from "tscircuit"
sel.R1.pin1
// ".R1 > .pin1"
sel.C1.pos
// ".C1 > .pos"
sel.net.GND
// "net.GND"
sel.U1.GPIO1
// ".U1 > .GPIO1"
```
So `sel` is really just a slightly more type-safe, conventional way of writing
[port selectors](./port-and-net-selectors.md). Where possible, it's much better to use [component hooks](../elements/chip.mdx#type-safe-chips-custom-component-hooks)
because they can guarantee more type-safety and have the exact pins that a chip
supports.
---
title: Using tscircuit without React
---
{/* tscircuit uses React by default for strong guarantees about how
components are imported and used, but you can also use tscircuit
without react. */}
:::tip
If you're interested in using tscircuit without react, please let us know
by [upvoting this issue!](https://github.com/tscircuit/tscircuit/issues/508)
:::
:::info
Are you interested in using tscircuit inside an iframe? Check out [this article](./running-tscircuit-inside-an-iframe.mdx)
:::
---
title: Installation
sidebar_position: 2
---
## Dependencies
To use tscircuit, you'll need to have [npm](https://npmjs.com) or [bun](https://bun.sh) installed. We recommend using [bun](https://bun.sh) for its speed and ease of use.
## Installing tscircuit
To install tscircuit's command line tool, just run:
```bash
npm install -g tscircuit
# or
bun install --global tscircuit
```
This will install a `tsci` command globally!
:::info
If you're using [tscircuit online](https://tscircuit.com), you can skip installation. tscircuit is fully-featured and usable online!
:::
You can test it out by running `tsci --help`!
```bash
tsci --help
Usage: tsci [options] [command]
CLI for developing tscircuit snippets
# Options:
# -V, --version output the version number
# -h, --help display help for command
# Commands:
# init Initialize a new TSCircuit project in the current directory
# dev [options] [file] Start development server for a snippet
# clone Clone a snippet from the registry
# auth Login/logout
# login Login to tscircuit registry
# config Manage tscircuit CLI configuration
# export [options] Export tscircuit code to various formats
# help [command] display help for command
```
You can also run `tsci` without any arguments to start the interactive CLI.
```bash
tsci
# ? Choose command ›
# ❯ tsci init - Initialize a new TSCircuit project in the current directory
# tsci dev - Start development server for a snippet
# tsci clone - Clone a snippet from the registry
# tsci auth - Login/logout
# tsci login - Login to tscircuit registry
# tsci config - Manage tscircuit CLI configuration
# tsci export - Export tscircuit code to various formats
```
### Creating a new project
The easiest way to create a template project is to use `tsci init` inside a project directory.
```bash
mkdir my-project
cd my-project
tsci init
```
This will bootstrap a fresh tscircuit project! Read more about
starting the development server and exporting files in our
[Quickstart CLI Guide](./quickstart-cli.md).
## Installing `tscircuit` per project
You can install `tscircuit` on a per-project basis by installing it as a dev dependency.
```bash
npm add -D tscircuit
# or
bun add -D tscircuit
```
## Next Steps
Now that you've installed tscircuit, you can start developing your first electronic device!
- [Quickstart CLI Guide](./quickstart-cli.md)
- [Understanding essential tscircuit elements](../guides/essential-elements.mdx)
- [What are electronics made of?](../building-electronics/what-are-electronics-made-of.mdx)
---
title: Quickstart CLI
sidebar_position: 4
---
## Install the tscircuit CLI
You can install the tscircuit CLI by running `npm install -g @tscircuit/cli`.
## Create a new Project
First, create a new tscircuit project by running `tsci init`. This will create a new directory with all the necessary files to get started:

## Run the Development Server
Next, start the development server by running `tsci dev`. This will start a local server that automatically rebuilds your circuit when you make changes:

Go to https://localhost:3020. You'll can now see PCB, Schematic and 3D views of your circuit, which update in real-time as you make changes to your code.

## Pushing to the tscircuit Registry
This section is coming soon!
## Exporting to SVGs, PDF, or Fabrication Files
This section is coming soon!
---
title: Quickstart Web
sidebar_position: 3
---
You can use tscircuit online without installing anything on [tscircuit.com](https://tscircuit.com)!
## Using the Online Editor
The [tscircuit online editor](https://tscircuit.com/editor) is a full Typescript editor with syntax highlighting, autocomplete, type-checking and tools for importing snippets and configuring chips.
There are two types of projects you can create in the online editor.
- **board**: a fully-functional electronic device that you can order
- **module**: a reusable component, usually a specific chip or subcircuit, that you can use across many boards or to break up a complex board into smaller, more manageable pieces.
To get started, let's create a simple board.
You can use the "New" button on [tscircuit.com](https://tscircuit.com) and select
"board" to open the editor with a blank board:
The editor will open with a template board that looks like this:
You can now edit the board by adding or removing elements! Check out the
[essential elements guide](../guides/essential-elements.mdx) to learn more about
the available elements. If you've already got an idea of what you want to build,
try breaking down the problem into modules using our [designing electronics from scratch guide](../building-electronics/designing-electronics-from-scratch.md)
After you make a change, click the "Run" button to see your changes applied. You
can use the PCB, Schematic, and 3D views to make sure everything is correctly
aligned.
When you're ready to manufacture your board, click the "Download" button to
download [fabrication files.](../guides/understanding-fabrication-files.md)
When you're ready to order your board, check out the [ordering prototypes guide](../building-electronics/ordering-prototypes.mdx). You can
electronics fully assembled and ready to use from the many services that accept
our standard fabrication files.
## Using the AI Assistant
Our AI assistant is available in beta but is undergoing a big overhaul. We'll update this section when we're happy with it!
---
title: What is tscircuit?
slug: /
sidebar_position: 1
---
tscircuit is an open-source React/Typescript electronics toolchain and ecosystem
for creating, previewing, simulating and manufacturing Printed Circuit Boards
(PCBs).
React and Typescript are standard tools that revolutionized the web development
ecosystem. tscircuit combines the powerful static analysis of Typescript with
the modular component system of React to make developing electronics faster,
easier and more automated.
Here's an example of a basic tscircuit electronic device, it's the USB
flashlight that we make in [this tutorial](../tutorials/building-a-simple-usb-flashlight.mdx).
{
const USBCPort = useUsbC("USBC")
const Button = usePushButton("SW1")
return (
)
}
`} />
This small snippet of code helps demonstrate the power of tscircuit. From those
40 lines, we were able to create a full PCB, Schematic and 3D preview. Not only
that, but we can export this circuit to [Fabrication Files](../guides/understanding-fabrication-files)
and get it fabricated and assembled. In fact we did!
import usbcflashlight from "@site/static/img/usbcflashlight_20250123_1816894.jpg"
It may not seem like much, but tscircuit just handled a _lot_ of work for us!
- Automatic Part Selection and Bill of Materials Generation
- Autorouting
- Schematic and PCB Layout
- 3D Model Generation
- Fabrication File Generation
...and it ran completely in our browser!
tscircuit isn't limited to simple circuits like this. You can keep adding
elements, creating modules and combining them to create more and more complex
circuits. Here's an example of a [simple 3x3 macrokeypad based on the PICO2!](https://tscircuit.com/seveibar/nine-key-keyboard)
`} />
We ordered this one too!
import macrokeypad from "@site/static/img/macrokeypad.png"
Depending on your experience level with electronics, you may want to get started
with any of the following resources:
- [Learn about the Essential tscircuit Elements](../guides/essential-elements)
- [How do I design an electronic device from scratch with tscircuit?](../building-electronics/designing-electronics-from-scratch)
- [Install tscircuit locally](./installation.md)
- [Explore tscircuit electronics online](https://tscircuit.com)
- [Drop our AI context into your Claude or OpenAI project](../advanced/ai-context.mdx)
---
title: Building a Simple USB Flashlight
---
## Overview
This tutorial will walk you through building a simple USB flashlight using
tscircuit.
{
const USBCPort = useUsbC("USBC")
const Button = usePushButton("SW1")
return (
)
}
`} />
---
title: Autorouting API
---
## Overview
tscircuit allows heavy customization of the autorouting process. In tscircuit
you can use local or cloud autorouters, use different autorouters for different
subcircuits, and disable autorouting entirely.
This page provides details on the autorouting cloud API so you can import your
own cloud autorouter.
## Using Custom Autorouters
Here's an example of how a customer autorouter can be configured with tscircuit:
(
)
`} />
### The Autorouter Object
The autorouter object is used to configure the autorouter. The following properties are supported:
- `serverUrl`: The URL of the autorouter server.
- `serverMode`: [`job`]( or `solve-endpoint`
- `inputFormat`: The format of the input to the autorouter server.
## Input and Output Formats
### Simplified Input/Output
The `simplified` input format is simple to build an autorouter for. It contains
a JSON object with the desired connections to make and the obstacles the algorithm must
avoid to solve the routing problem.
When using the `simplified` input format, the `/autorouting/jobs/create` and/or `/autorouting/solve`
endpoint must accept a `input_simple_route_json` file with the following interface:
```tsx
interface SimpleRouteJson {
layerCount: number
minTraceWidth: number
obstacles: Obstacle[]
connections: Array
bounds: { minX: number; maxX: number; minY: number; maxY: number }
}
interface Obstacle {
type: "rect"
layers: string[]
center: { x: number; y: number }
width: number
height: number
connectedTo: string[]
}
interface SimpleRouteConnection {
name: string
pointsToConnect: Array<{ x: number; y: number; layer: string }>
}
```
Here's an example of a `SimpleRouteJson` object:
```json
{
"layerCount": 2,
"minTraceWidth": 0.2,
"obstacles": [
{
"type": "rect",
"layers": ["top"],
"center": { "x": 30, "y": 25 },
"width": 10,
"height": 8,
"connectedTo": ["power"]
},
{
"type": "rect",
"layers": ["bottom"],
"center": { "x": 70, "y": 25 },
"width": 12,
"height": 6,
"connectedTo": ["ground"]
}
],
"connections": [
{
"name": "power_net",
"pointsToConnect": [
{ "x": 10, "y": 10, "layer": "top" },
{ "x": 90, "y": 40, "layer": "bottom" }
]
},
{
"name": "ground_net",
"pointsToConnect": [
{ "x": 20, "y": 20, "layer": "top" },
{ "x": 80, "y": 30, "layer": "top" }
]
}
],
"bounds": {
"minX": 0,
"maxX": 100,
"minY": 0,
"maxY": 50
}
}
```
When in `simplified` mode you should respond with an
`output_simple_route_json` object that adds a `traces` field to the original
input object.
```json
{
"output_simple_route_json": {
// ...the original input object fields
"traces": [
{
"type": "pcb_trace",
"pcb_trace_id": "trace_1",
"route": [
{
"route_type": "via",
"x": 45,
"y": 25,
"from_layer": "top",
"to_layer": "bottom"
},
{
"route_type": "wire",
"x": 45,
"y": 25,
"width": 0.2,
"layer": "bottom"
},
{
"route_type": "wire",
"x": 60,
"y": 35,
"width": 0.2,
"layer": "bottom"
}
]
}
]
}
}
```
The `traces` field should match this type:
```tsx
type SimplifiedPcbTraces = Array<{
type: "pcb_trace"
pcb_trace_id: string
route: Array<
| {
route_type: "wire"
x: number
y: number
width: number
layer: string
}
| {
route_type: "via"
x: number
y: number
to_layer: string
from_layer: string
}
>
}>
```
### Circuit JSON Input/Output
When using `inputFormat: "circuit_json"` you the API must accept `{ input_circuit_json }` and
respond with PCB traces in the format `{ output_pcb_traces }` that can be concatenated to the Circuit JSON to complete the circuit.
## Choosing a `serverMode`
When you're implementing the autorouter API, you can choose to implement either
the `job` API (recommended) or the `solve-endpoint` API. The `solve-endpoint` is easier because
it's a single endpoint, but has many limitations because it must perform the
autorouting in the lifecycle of a single request.
When defining your autorouter object, you can choose the `serverMode` and `inputFormat`
to correspond to what you've implemented.
## The `solve-endpoint` API
| Endpoint | Description |
| -------- | ----------- |
| `/autorouting/solve` | Takes autorouting input and returns the solved routes |
### `solve-endpoint` with `simplified` input
```
POST /autorouting/solve
{
"input_simple_route_json": {
// ...
}
}
RESPONSE:
{
"output_simple_route_json": {
// ...
}
}
```
### `solve-endpoint` with `circuit_json` input
```
POST /autorouting/solve
{
"input_circuit_json": {
// ...
}
}
RESPONSE:
{
"output_pcb_traces": [
{
"type": "pcb_trace",
"pcb_trace_id": "trace_1",
"route": [
// ...
]
}
]
}
```
## The `job` API
The `job` autorouting API allows you to perform long-running autorouting jobs for
large circuits. When using the `job` API, you must use the `"circuit_json"` input format.
| Endpoint | Description |
| -------- | ----------- |
| `/autorouting/jobs/create` | Create the autorouting job |
| `/autorouting/jobs/get` | Get the status of the autorouting job |
| `/autorouting/jobs/cancel` | Cancel the autorouting job |
| `/autorouting/jobs/get_output` | Get the solved routes from a completed autorouting job |
:::info
Here's the [source code](https://github.com/tscircuit/core/blob/main/lib/components/primitive-components/Group/Group.ts#L232) in tscircuit core where the `job` API is used to autoroute a circuit. You can
see that each endpoint is called in order
:::
```
POST /autorouting/jobs/create
{
"input_simple_route_json": {
// ...
},
"autostart": true
}
RESPONSE:
{
"autorouting_job": {
"autorouting_job_id": "1234567890",
// ...
}
}
GET /autorouting/jobs/get?autorouting_job_id=1234567890
RESPONSE:
{
"autorouting_job": {
"is_running": false,
"is_finished": true,
// ...
}
}
GET /autorouting/jobs/get_output?autorouting_job_id=1234567890
RESPONSE:
{
"autorouting_job_output": {
"output_pcb_traces": [
// ...
]
}
}
```
## Additional Configuration
Additional configuration parameters can be passed to either the `/autorouting/jobs/create`
endpoint or the `/autorouting/solve` endpoint to configure the autorouter.
| Parameter | Example Value | Description |
| --------- | ------------- | ----------- |
| `display_name` | `"Nine-key Macropad"` | A display name for the autorouting job. Useful for debugging! |
| `provider` | `"freerouting"` | The autorouting algorithm to use |
| `subcircuit_id` | `"subcircuit_source_group_1"` | To support subcircuit autorouting, you must accept this parameter and only solve for the subset of routes within the subcircuit. |
---
title: Registry API
sidebar_position: 1
---
The tscircuit Registry API is an extension of the NPM Registry API that allows for additional features, such as building Circuit JSON in the cloud, automatic bundling to ESM and CommonJS, and more versioning automations.
## Using the tscircuit NPM Registry
The [regular public NPM registry API](https://github.com/npm/registry/blob/main/docs/REGISTRY-API.md) is available via `npm.tscircuit.com`. You can install endpoints from this registry
by adding the following line to your `.npmrc` (or in
any project with a `package.json` file)
```
@tsci:registry=https://npm.tscircuit.com
```
This line says "any package starting with @tsci should
go to the tscircuit registry instead of the npm registry"
So you can now do `bun add @tsci/seveibar.usb-c-flashlight` to install that
circuit to your npm project!
## tscircuit Package Format
Every tscircuit package is in the format `@tsci/.` to
avoid conflicts with other npm packages.
## Advanced Bundling Endpoints
tscircuit runs an ESM and CJS bundling service, you can use these
services to get a bundled version of any circuit, this is great
for dynamic loading and execution, e.g. we use it in our [tscircuit/import](https://github.com/tscircuit/import) module!
## Advanced Registry Endpoints
You can use your tscircuit CLI token to use the advanced API at `https://registry-api.tscircuit.com`.
You can get a tscircuit auth token with `tsci auth print-token`. After you get this token, you just need to add the `Authorization: Bearer ${token}` header to each API request.
The following endpoints are available:
| Endpoint | Purpose |
| -------------------------- | ------------------------------------------------------------ |
| `/package_files/list` | List all the files in a package |
| `/package_files/create` | Add a file to a package |
| `/package_files/download` | Download a file from a package |
| `/packages/search` | Search for a package |
| `/packages/list` | List your packages |
| `/package_releases/create` | Create a new release (version) of a package |
| `/package_releases/update` | Update a package release, e.g. to lock it from modifications |
| `/package_releases/get` | Get a package release |
| `/package_releases/list` | List package releases for a package |
More information about our Advanced Registry API is coming soon, including a full OpenAPI specification!
## Advanced Autorouting Endpoints
You can also use the registry to perform autorouting jobs for a
[Circuit JSON](https://github.com/tscircuit/circuit-json) file.
| Endpoint | Purpose |
| ------------------------------ | ------------------------------------ |
| `/autorouting/jobs/create` | Create a new autorouting job |
| `/autorouting/jobs/get` | Get the status of an autorouting job |
| `/autorouting/jobs/get_output` | Get the output of an autorouting job |
## Endpoint Documentation
### `/packages/search`
Search for a package by name.
```
POST /packages/search
{
"query": "555timer"
}
RESPONSE:
{
"packages": [
{
"name": "@tsci/555timer",
"version": "1.0.0",
"description": "A 555 timer circuit"
}
]
}
```
# [docs.tscircuit.com](https://docs.tscircuit.com)
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
Run `bun i` and `bun run start` to start a local development server.