Skip to main content
Symbols can be copied to the clipboard in two S-expression formats, or the whole library can be downloaded as its raw .kicad_sym file. Clipboard building lives in src/lib/clipboard.ts and runs entirely client-side from the symbol’s pin data.

Two clipboard formats

Canvas

buildCanvasClipboardSexp(symbol) → two-part block: (lib_symbols …) + a (symbol …) instance block (UUID, position, instances). Paste directly onto a KiCad/Trace schematic canvas. This is the default “Copy” action.

Library

buildKicadSymSexp(symbol) → a standard (kicad_symbol_lib …) wrapper with one symbol. Paste into a .kicad_sym file or a library editor.
import {
  buildCanvasClipboardSexp, buildKicadSymSexp,
  copySymbolForCanvas, copySymbolForLibrary,
} from "@/lib/clipboard";

await copySymbolForCanvas(symbol);    // writes canvas S-expr to navigator.clipboard
await copySymbolForLibrary(symbol);   // writes library S-expr
Both builders partition pins — left: input, power_in, passive; right: everything else (50/50 split if untyped) — and size the body at max(maxSide·2.54 + 2.54, 7.62) mm on a 2.54 mm grid. Generator tag: trace_symbols.
The canvas format must be two-part. A bare (kicad_symbol_lib …) block will not paste into the editor — it needs the (lib_symbols …) + (symbol …) instance block.

Download the raw library — GET /api/download/[library]

Serves the raw original .kicad_sym from data/ (or data/cern-symbols/), preserving graphics, multi-unit symbols, and all properties. Falls back to the compiled per-library JSON if no raw file exists.
GET /api/download/Amplifier_Operational
→ 200  Content-Type: application/x-kicad-sym
       Content-Disposition: attachment; filename="Amplifier_Operational.kicad_sym"
       Cache-Control: public, max-age=86400
Download serves the full-fidelity upstream file; the clipboard reconstructs from parsed pin data (quick, editable, but graphics-free). Use download when fidelity matters.