Skip to main content
Built-in Elements

<port />

Overview

<port /> defines a named electrical connection point. Its meaning depends on its parent:

  • Inside <symbol />, it defines the position and direction of a custom schematic pin.
  • As a direct child of <group />, it defines a public port for a module. When the group uses showAsSchematicBox, the port appears as a pin on the module's collapsed schematic symbol.

Custom symbol pins

export default () => (
<board width="10mm" height="10mm">
<chip
name="D1"
symbol={
<symbol>
{/* Diode triangle */}
<schematicline x1={-0.3} y1={-0.4} x2={-0.3} y2={0.4} strokeWidth={0.05} />
<schematicline x1={-0.3} y1={0.4} x2={0.3} y2={0} strokeWidth={0.05} />
<schematicline x1={0.3} y1={0} x2={-0.3} y2={-0.4} strokeWidth={0.05} />
{/* Cathode bar */}
<schematicline x1={0.3} y1={-0.4} x2={0.3} y2={0.4} strokeWidth={0.05} />
{/* Ports */}
<port name="A" schX={-0.3} schY={0} direction="left" />
<port name="K" schX={0.3} schY={0} direction="right" />
</symbol>
}
/>
</board>
)
Schematic Circuit Preview

Group interface ports

Use connectsTo to map a group's public port to a selector inside that group:

export default () => (
<board width="20mm" height="12mm">
<group
name="FILTER"
showAsSchematicBox
schTitle="RC Filter"
pcbX={-4}
>
<port name="VIN" direction="left" connectsTo="R1.pin1" />
<port name="VOUT" direction="right" connectsTo="R1.pin2" />
<resistor name="R1" resistance="1k" footprint="0402" />
</group>

<net name="VCC" />
<trace from="net.VCC" to="FILTER.VIN" />

<resistor
name="R_LOAD"
resistance="20k"
footprint="0402"
pcbX={4}
connections={{ pin1: "FILTER.VOUT", pin2: "net.GND" }}
/>
</board>
)
Schematic Circuit Preview

FILTER.VIN and FILTER.VOUT are public selectors. connectsTo maps them to R1.pin1 and R1.pin2, respectively. Outside the group, the trace connects net.VCC to FILTER.VIN, while the load connects to FILTER.VOUT.

Props

PropTypeDescription
namestringPort name used in selectors. Either name or pinNumber is required.
pinNumbernumberNumeric pin identifier. When name is omitted, the port name defaults to pin followed by the number, such as pin1.
connectsTostring | string[]For a direct group child, the internal port selector or selectors represented by this module port. For example, "D1.anode" or ["D1.anode", "D2.anode"].
direction"left" | "right" | "up" | "down"Schematic-facing direction. In a schematic-box group, it determines the default side unless schPinArrangement overrides it. This prop affects presentation, not connectivity.
schX, schYnumberSchematic coordinates within a custom symbol. They are not required for direct group-child ports.
aliasesstring[]Alternative names by which the port can be selected.
schStemLengthnumberLength of the stem line extending from a custom-symbol port.

Mapping one public port to multiple pins

<port
name="ROW1"
direction="left"
connectsTo={["D1.anode", "D2.anode", "D3.anode"]}
/>

connectsTo accepts a selector or an array of selectors. Use the array form when a public module port represents a shared internal net, such as an LED matrix row. Each selector identifies an internal component and one of its port names or aliases. With default pin labels, <led /> provides anode/cathode and pin1/pin2 selectors.

Custom Stem Length

Use schStemLength to control how far the connection stem extends from the port:

export default () => (
<board width="10mm" height="10mm">
<chip
name="U1"
symbol={
<symbol>
{/* Op-amp triangle */}
<schematicline x1={-0.5} y1={-0.7} x2={-0.5} y2={0.7} strokeWidth={0.05} />
<schematicline x1={-0.5} y1={0.7} x2={0.7} y2={0} strokeWidth={0.05} />
<schematicline x1={0.7} y1={0} x2={-0.5} y2={-0.7} strokeWidth={0.05} />
{/* Plus/minus labels */}
<schematictext schX={-0.35} schY={0.35} text="+" fontSize={0.3} />
<schematictext schX={-0.35} schY={-0.35} text="-" fontSize={0.3} />
{/* Ports with custom stem lengths */}
<port name="IN+" schX={-1} schY={0.35} direction="left" schStemLength={0.5} />
<port name="IN-" schX={-1} schY={-0.35} direction="left" schStemLength={0.5} />
<port name="OUT" schX={1.1} schY={0} direction="right" schStemLength={0.4} />
</symbol>
}
/>
</board>
)
Schematic Circuit Preview