`<mosfet footprint="sot23">` puts the gate on the drain pad of real SOT-23 MOSFETs, and has no `pinLabels` to fix it

Open
#5,525 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@aswadi is already working on this.

Since Nov 15, 2026.

  • #5532 by @aswadi — open
  • #5544 by @mukesh-dev-git — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
tooling

Research direction

Start from the <transistor> change in #4775, since that is the precedent: find how pinLabels is declared on the transistor props in @tscircuit/props and applied in core, then look at MosfetProps and the mosfet implementation to see how the sot23 footprint's pad-to-port mapping is produced. Compare against the circuit.json pad positions in the issue and add a focused test asserting that Q1.gate lands on pad 1 for footprint="sot23". Done means either a working pinLabels prop or a corrected G-S-D default, with that test passing.

Written by the indexing model from the issue text.

Description

<mosfet footprint="sot23"> puts the gate on the pad where real SOT-23 MOSFETs have their drain, and unlike <transistor> (fixed in #4775) there is no pinLabels to change it.

<mosfet name="Q1" channelType="n" mosfetMode="enhancement" footprint="sot23" />

What it builds (from circuit.json, pad positions relative to the part):

Pad Position <mosfet> port
1 (-1.14, 0.95) drain
2 (-1.14, -0.95) source
3 (1.14, 0) — the lone pad gate

What the parts' datasheets say (SOT-23, all N-channel):

Part Pin 1 Pin 2 Pin 3 (lone pad)
AO3400A (Alpha & Omega, rev 3.1, p.1) Gate Source Drain
BSS138 (onsemi, rev 7, p.1 marking diagram) Gate Source Drain
JLCPCB's own AO3400A footprint (tsci import C347475) G S D

So with the built-in component, the net you connect to Q1.gate lands on the real part's drain, and Q1.drain lands on its gate. The board builds with no warnings and the error only shows up after assembly.

No way around it inside <mosfet>: MosfetProps has no pinLabels, and passing one anyway is silently ignored (the gate stays on pad 3, no error):

<mosfet name="Q2" channelType="n" mosfetMode="enhancement" footprint="sot23"
  pinLabels={{ pin1: "gate", pin2: "source", pin3: "drain" }} />

For comparison, <transistor> got exactly this in #4775 and it works: pinLabels={{ pin1: "base", pin2: "emitter", pin3: "collector" }} moves base to pad 1 as expected.

Suggested fix: either give <mosfet> the same pinLabels support as <transistor>, or (better for new users) make the default order G-S-D, which matches the common SOT-23 MOSFETs (AO3400/AO3401, BSS138, 2N7002, SI2302 and similar). The current workaround is a <chip> with pinLabels, which loses the MOSFET symbol.

Found while building a 555 PWM dimmer; I used the imported JLCPCB part instead.

Versions: tscircuit 0.0.3188, @tscircuit/core 0.0.2380, @tscircuit/props 0.0.732

Dominant language
TypeScript
Stars
61
Forks
256
Avg merge
20h 21m
Merged PRs (30d)
289

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tscircuit/core

All issues in tscircuit/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.