Skip to content

Code Window

Code for case studies and developer portfolios: file tabs, a language label, copy, line numbers, highlighted and diff lines, and soft wrap. Plain text by default; bring your own highlighter.

Installation

pnpm dlx shadcn@latest add @portfolio-kit/code-window
First time? Add the @portfolio-kit registry to components.json
components.json
{
  "registries": {
    "@portfolio-kit": "https://www.parthjadhav.com/products/portfolio-kit/r/{name}.json"
  }
}

Usage

Examples

Diff

Show what changed in a case study: diff tints lines starting with + and −, and copying gives the new code without the markers.

With a highlighter

Bring any syntax highlighter: pass one rendered node per line as highlighted (e.g. from shiki's codeToTokens). This example uses a tiny hand-written tokenizer instead of a dependency.

API Reference