7-opentui-component

April 9, 2026 ยท View on GitHub

Two minimal OpenTUI apps that embed HunkDiffView directly.

For package install and API details, see OpenTUI component docs.

Run

bun run examples/7-opentui-component/from-files.tsx
bun run examples/7-opentui-component/from-patch.tsx

What it shows

  • embedding HunkDiffView inside a normal OpenTUI app shell
  • building diff.metadata with parseDiffFromFile
  • parsing raw unified diff text with parsePatchFiles
  • switching between split and stacked layouts with example shell controls
  • a scrollable terminal diff component that other OpenTUI apps can reuse

The in-repo demos import from ../../src/opentui so they run from source. Published consumers should import from hunkdiff/opentui instead.