<board />
The <board />
element is a root element that contains all the chips and traces
to create a PCB.
You can think of a <board />
like a <body />
element in HTML. Everything
goes in a board!
export default () => (
<board width="10mm" height="10mm">
<resistor resistance="1k" footprint="0402" name="R1" />
</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 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. For tscircuit.com this defaults tosequential-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 library.
You can also specify a custom autorouter object to use your own autorouter.
export default () => (
<board
width="20mm"
height="20mm"
autorouter={{
serverUrl: "https://registry-api.tscircuit.com",
serverMode: "job",
inputFormat: "simplified",
}}
>
<chip name="U1" footprint="soic8" pcbX={5} pcbY={0} />
<resistor
name="R1"
pcbX={-5}
pcbY={0}
resistance={100}
footprint="0402"
/>
<trace from=".U1 > .pin1" to=".R1 > .pin1" />
</board>
)
Learn more about the Autorouting API here
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!
export default () => (
<board
outline={[
{ x: -22.5, y: 24.5 },
{ x: 22.5, y: 24.5 },
{ x: 22.5, y: 16.5 },
{ x: 20.5, y: 16.5 },
{ x: 20.5, y: 12.5 },
{ x: 22.5, y: 12.5 },
{ x: 22.5, y: 2.5 },
{ x: 18, y: -1.5 },
{ x: 18, y: -18 },
{ x: -18, y: -18 },
{ x: -18, y: -1.5 },
{ x: -22.5, y: 2.5 },
{ x: -22.5, y: 12.5 },
{ x: -20.5, y: 12.5 },
{ x: -20.5, y: 16.5 },
{ x: -22.5, y: 16.5 },
{ x: -22.5, y: 24.5 },
]}
// These are currently required due to this issue:
// https://github.com/tscircuit/core/issues/564
width="50mm"
height="50mm"
/>
)
Offseting the board origin
width
and height
set the board's bounding box (and thus the pcbX
/pcbY
coordinate system) even when you're using a custom outline. Add
outlineOffsetX
and outlineOffsetY
—measured in millimeters, whether passed as
numbers or strings like "5mm"
—to slide that outline relative to the bounding
box so (0, 0)
lands where you expect. Positive offsets push the outline toward
increasing pcbX
/pcbY
coordinates.
In this example the outline is shifted half the board's width and height so the origin stays at the lower-left corner while the shape itself is centered:
export default () => (
<board
width="40mm"
height="30mm"
outlineOffsetX="20mm"
outlineOffsetY="15mm"
>
<chip name="U1" footprint="qfn32" pcbX={5} pcbY={5} />
<resistor name="R1" footprint="0402" resistance="1k" pcbX={10} pcbY={12} />
</board>
)
Flexible PCBs
Interested in flexible PCBs? Upvote this issue on Github!