Components

A component is anything that has a KiCAD symbol or footprint — resistors, MCUs, vias, mounting holes, or regulatory images. The Component class is the base class for all of them.

class

Component

The base class for all components in typeCAD — in KiCAD terms, anything that has a footprint file associated with it. Construct it directly for simple parts, or extend it with named pins for ICs (usually via the add-component tool, below).

Example first

component.ts
import { Component } from '@typecad/pcb';

let u1 = new Component({ footprint: 'Package_SO:SOIC-8_5.3x5.3mm_P1.27mm' });

Options

OptionTypeDescription
referencestringReference designator (R1, U2...)
valuestringValue of component
footprintstringKiCAD footprint path, e.g. Package_SO:SOIC-8_5.3x5.3mm_P1.27mm
symbolstringKiCAD symbol library path
prefixstringPrefix for reference designator
datasheetstringLink to component datasheet
descriptionstringDescription of component
voltagestringVoltage rating of component
wattagestringWattage rating of component
mpnstringManufacturer Part Number
dnpbooleantrue if Do Not Populate
simulationobject{ include: true, model: 'ngspice-model' }
pcbobjectPosition on the board { x, y, rotation }
textarrayArbitrary text entries on the board, with property, text, position, styling
fabobjectFabrication layer text entry — a positioning object or [text, positioning] tuple
referenceLayoutobjectReference designator text position and style (defaults to F.SilkS)
valueLayoutobjectValue text position and style (defaults to F.Fab)
fabLayoutobjectFab text position and style (defaults to F.Fab; text defaults to ${REFERENCE})

The three layout properties (referenceLayout, valueLayout, fabLayout) accept an ITextPositioning object and can be set at construction or assigned after creation.

pin pin(number, config?): Pin

Creates and registers a pin — see Pins & Power. In generated component files this is how named pins (u1.VCC) are defined.

Connectors & mechanical parts

A few common non-IC parts ship as ready-made classes, alongside the passives — all from the package root:

import { Connector, TestPoint, MountingHole, NetTie } from '@typecad/pcb';

let j1 = new Connector({ number: 4 });            // 1x04 pin header (series presets: 'pin-header', 'JST-SH')
let tp1 = new TestPoint();                        // 1.0 mm pad probe point
let mh1 = new MountingHole({ size: 'M3' });       // M2–M8 presets
let tie1 = new NetTie({ net1: 'VBUS', net2: 'VOUT' });  // ties two nets, pin count follows the nets

typecad add component

The better way to create components. Run typecad-pcb add component from the ./hw directory, or click the add_component button in the VSCode GUI under NPM Scripts. It asks where the component comes from — the KiCAD library, a local file, or an EasyEDA/JLCPCB part — and generates a .ts file like this:

ATtiny85_20S.ts
import { Component } from '@typecad/pcb';
/**
 | Pin # | Name         | Type              |
 | --:   | :--          | :--               |
 | 8     | VCC          | power_in          |
 | 4     | GND          | power_in          |
 | 5     | AREF_PB0     | bidirectional     |
 | 1     | _RESET_PB5   | bidirectional     |
 */
export class ATtiny85_20S extends Component {
    VCC = this.pin(8, { type: 'power_in' });
    GND = this.pin(4, { type: 'power_in' });
    AREF_PB0 = this.pin(5, { type: 'bidirectional' });
    _RESET_PB5 = this.pin(1, { type: 'bidirectional' });

    constructor(reference?: string | undefined) {
        super("Package_SO:SOIC-8_5.3x5.3mm_P1.27mm");
        this.symbol = "MCU_Microchip_ATtiny:ATtiny85-20S";
        if (reference) this.reference = reference;
    }
}

The file extends Component and adds Pin objects — so instead of u1.pin(1) you write u1.VCC. Use the generated class like any other:

use.ts
import { ATtiny85_20S } from './ATtiny85_20S';
let u1 = new ATtiny85_20S();

Finding parts: typecad-pcb search

terminal
typecad-pcb search "voltage regulator"
typecad-pcb search LM358
typecad-pcb search "SOIC-8" --footprint --json

Fuzzy-matches against the KiCAD symbol libraries and returns the symbol name, footprint, and description, in LibraryName:SymbolName format. With --footprint, it searches the installed footprint libraries instead — results include the pad numbers. Options: --format (detailed, compact, table, json), --sort (score, id, manufacturer, package), --limit (default 5).

© 2026 typeCAD — code-defined electronics github