{"id":49057729,"url":"https://github.com/holo-q/Ratatui.cs","last_synced_at":"2026-05-06T05:00:58.508Z","repository":{"id":313842859,"uuid":"1053104953","full_name":"holo-q/Ratatui.cs","owner":"holo-q","description":".NET bindings for Ratatui (Rust TUI) with headless testing, events, batching","archived":false,"fork":false,"pushed_at":"2025-09-24T18:26:08.000Z","size":441,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T05:38:14.404Z","etag":null,"topics":["bindings","csharp","dotnet","ratatui","tui"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holo-q.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-09T02:05:49.000Z","updated_at":"2025-11-18T17:38:42.000Z","dependencies_parsed_at":"2025-09-09T05:01:55.098Z","dependency_job_id":"3a8b070d-a09d-4626-ae74-33c825415da4","html_url":"https://github.com/holo-q/Ratatui.cs","commit_stats":null,"previous_names":["holo-q/ratatui.cs"],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/holo-q/Ratatui.cs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holo-q%2FRatatui.cs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holo-q%2FRatatui.cs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holo-q%2FRatatui.cs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holo-q%2FRatatui.cs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holo-q","download_url":"https://codeload.github.com/holo-q/Ratatui.cs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holo-q%2FRatatui.cs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32679444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T02:33:58.958Z","status":"ssl_error","status_checked_at":"2026-05-06T02:33:39.611Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","csharp","dotnet","ratatui","tui"],"created_at":"2026-04-20T00:00:55.800Z","updated_at":"2026-05-06T05:00:58.501Z","avatar_url":"https://github.com/holo-q.png","language":"C#","funding_links":[],"categories":["📦 Libraries"],"sub_categories":["🔗 Bindings"],"readme":"\n\u003c!-- \u003cimg src=\"\" alt=\"ratatui_ffi logo\" width=\"36\"/\u003e --\u003e\n\u003cimg src=\"./logo.webp\" width=\"120\" align=\"right\" alt=\"Ratatui.cs logo\"/\u003e\n\n#  Ratatui.cs — .NET/C# Terminal UI (TUI) Library powered by Rust Ratatui\n\n[![GitHub Release](https://img.shields.io/github/v/release/holo-q/Ratatui.cs?logo=github)](https://github.com/holo-q/Ratatui.cs/releases)\n[![NuGet](https://img.shields.io/nuget/v/Ratatui.cs.svg?logo=nuget\u0026label=NuGet)](https://www.nuget.org/packages/Ratatui.cs)\n[![NuGet Downloads](https://img.shields.io/nuget/dt/Ratatui.cs.svg?logo=nuget)](https://www.nuget.org/packages/Ratatui.cs)\n![CI](https://github.com/holo-q/Ratatui.cs/actions/workflows/ci.yml/badge.svg)\n[![Guard](https://github.com/holo-q/Ratatui.cs/actions/workflows/guard.yml/badge.svg)](https://github.com/holo-q/Ratatui.cs/actions/workflows/guard.yml)\n[![Snapshots Auto](https://github.com/holo-q/Ratatui.cs/actions/workflows/snapshots-on-ci.yml/badge.svg)](https://github.com/holo-q/Ratatui.cs/actions/workflows/snapshots-on-ci.yml)\n\nHigh-performance, cross-platform Terminal UI (TUI) for .NET and C#. Ratatui.cs exposes the battle-tested Rust Ratatui engine over a stable FFI with an idiomatic C# API. Build rich console apps with widgets, layout, keyboard/mouse events, batched frame rendering, and headless snapshot testing. Works on Windows, Linux, and macOS.\n\nPerformance promise: zero-allocation hot paths. We design the C# layer to honor Rust’s performance standards — span-first APIs, stackalloc/ArrayPool, and batched FFI calls. Most text setters offer `ReadOnlySpan\u003cbyte\u003e` (\"u8\") overloads and batched span builders to avoid heap allocations in frame loops. We also ship a build-time coverage guard to keep 100% parity with the native FFI and fail on drift.\n\n## Features\n- Rich widgets: Paragraph, List (stateful), Table (stateful), Gauge, Tabs, BarChart, Sparkline, Scrollbar.\n- Input events: Keyboard and mouse (down/up/drag/move/scroll + modifiers), resize.\n- Rendering: Draw into rects, batched DrawFrame for multiple widgets.\n- Testing: Headless renderers for widgets and composite frames; deterministic event injection.\n- Ergonomics: Vec2i swizzles, Rect aliases (x/y/w/h), simple C# layout helpers.\n- Cross-platform: Prebuilt native binaries per RID (linux-x64, win-x64, osx-x64, osx-arm64).\n\n## Why Ratatui.cs?\n- Performance first: powered by Rust Ratatui engine, efficient rendering + input. Zero-allocation hot paths via `ReadOnlySpan\u003cbyte\u003e` (u8) overloads and batching; we actively avoid heap churn in frame loops and hold ourselves to Rust-grade perf.\n- Production ready: headless snapshot testing for CI with deterministic results.\n- Idiomatic C#: fluent, disposable widgets and safe handles, simple layout.\n- Cross‑platform binaries: Windows, Linux, macOS with per‑RID native assets.\n\n## Install\n- NuGet: `dotnet add package Ratatui.cs`\n\n## Quickstart\n```csharp\nusing Ratatui;\n\nusing var term = new Terminal();\nusing var p = new Paragraph(\"Hello from C#\").Title(\"Demo\");\nvar (w,h) = term.Size();\nterm.Draw(p, new Rect(0,0,w,h));\n\n// Batched frame\nterm.DrawFrame(\n  DrawCommand.Paragraph(p, new Rect(0,0,w/2,h)),\n  DrawCommand.Gauge(new Gauge().Ratio(0.42f).Title(\"Load\"), new Rect(w/2,0,w/2,3))\n);\n```\n\n## Headless snapshots (CI-friendly)\n```csharp\nusing Ratatui.Testing;\nusing var table = new Table().Title(\"T\").Headers(\"A\",\"B\").AppendRow(\"1\",\"2\");\nvar snapshot = Headless.RenderTable(30, 6, table);\nConsole.WriteLine(snapshot);\n```\n\n## Snapshots\n\n#### CI “seal of approval”\n\nThese screenshots are auto‑generated by CI after a green run. The snapshots‑on‑ci workflow builds the native engine, runs our headless renderers, converts the ASCII frames to PNG, and commits them back to this repo. Treat them as a living seal that the entire stack (Rust FFI + C# API + widgets) is working end‑to‑end in real CI.\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cb\u003eParagraph\u003c/b\u003e\u003cbr/\u003e\n      \u003cimg src=\"docs/assets/snapshots/paragraph.png\" alt=\"Paragraph snapshot\" width=\"300\"/\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cb\u003eTable\u003c/b\u003e\u003cbr/\u003e\n      \u003cimg src=\"docs/assets/snapshots/table.png\" alt=\"Table snapshot\" width=\"300\"/\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cb\u003eChart\u003c/b\u003e\u003cbr/\u003e\n      \u003cimg src=\"docs/assets/snapshots/chart.png\" alt=\"Chart snapshot\" width=\"300\"/\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cb\u003eTabs\u003c/b\u003e\u003cbr/\u003e\n      \u003cimg src=\"docs/assets/snapshots/tabs.png\" alt=\"Tabs snapshot\" width=\"300\"/\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cb\u003eGauge\u003c/b\u003e\u003cbr/\u003e\n      \u003cimg src=\"docs/assets/snapshots/gauge.png\" alt=\"Gauge snapshot\" width=\"300\"/\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cb\u003eCombined (mini dashboard)\u003c/b\u003e\u003cbr/\u003e\n      \u003cimg src=\"docs/assets/snapshots/combined.png\" alt=\"Combined snapshot\" width=\"600\"/\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \n\u003c/table\u003e\n\n## What this is\n- Native Rust cdylib (`native/ratatui_ffi`) with a stable C ABI over Ratatui.\n- Idiomatic .NET library (`src/Ratatui`) with SafeHandles and builders.\n- Headless snapshot rendering for CI and smoke tests (no terminal required).\n\n## Using in your app (source)\n- Add a ProjectReference to `src/Ratatui/Ratatui.csproj`.\n- Ensure the native library is discoverable (Resolver searches `runtimes/\u003crid\u003e/native/` and common dev `target/` paths). You can override with `RATATUI_FFI_DIR` env var.\n\n## Using via NuGet (CI-packaged)\n- CI builds native libraries for: linux-x64, win-x64, osx-x64, osx-arm64.\n- NuGet includes RID-specific native assets under `runtimes/\u003crid\u003e/native/`.\n- After CI, download the `.nupkg` from artifacts or releases and reference it in your project.\n\n## Snapshots: how they are generated\n- Ad-hoc: run the \"snapshots-local\" workflow (workflow_dispatch). It builds the native lib, runs the snapshots example to emit ASCII, converts to PNG via ImageMagick, and uploads both as artifacts.\n- On release tags (vX.Y.Z): the \"snapshots-release\" workflow generates PNGs and commits them to `docs/assets/snapshots`, keeping this README section's images fresh.\n\n## Local dev (build from source)\n1) Build native\n   - `cd native/ratatui_ffi \u0026\u0026 cargo build` (or `cargo build --release`)\n2) Run examples\n   - Interactive hello: `dotnet run --project examples/Hello/Hello.csproj`\n   - Interactive gallery (tabs + list + table + gauge + sparkline): `dotnet run --project examples/Gallery/Gallery.csproj`\n   - Headless snapshots: `dotnet run --project examples/Smoke/Smoke.csproj`\n   - Composite headless: `dotnet run --project examples/SmokeFrame/SmokeFrame.csproj`\n   - If you see DllNotFoundException, point the loader to your native build:\n     - `export RATATUI_FFI_DIR=$(pwd)/native/ratatui_ffi/target/debug` (or `.../release`)\n     - Or set `RATATUI_FFI_PATH` to the full path of the built library (`libratatui_ffi.so`/`.dylib` or `ratatui_ffi.dll`).\n\n## CI: Build native + pack NuGet\n- Workflow: `.github/workflows/ci.yml`\n- Jobs:\n  - Build native per RID (linux-x64, win-x64, osx-x64, osx-arm64) and upload artifacts.\n  - Pack job downloads artifacts, copies them into `src/Ratatui/runtimes/\u003crid\u003e/native/`, and runs `dotnet pack`.\n  - Outputs a `.nupkg` under `artifacts/`; publishes to GitHub Packages on tags and main; optionally to nuget.org on tags.\n\n## Publishing and feeds\n- GitHub Packages (default): the CI publishes on tags (vX.Y.Z) and on main/master to `https://nuget.pkg.github.com/holo-q/index.json`.\n  - Add the source (once):\n    - `dotnet nuget add source https://nuget.pkg.github.com/holo-q/index.json -n holo-q -u \u003cgithub-username\u003e -p \u003cgithub-personal-access-token\u003e --store-password-in-clear-text`\n  - Install: `dotnet add package Ratatui.cs --version \u003cx.y.z\u003e`\n- nuget.org (optional): if `NUGET_API_KEY` is set in repo secrets, tags publish to nuget.org as well.\n\n## 0.30 alpha preview (opt-in)\n- A preview workflow builds Ratatui.cs against ratatui 0.30 (FFI submodule branch `ratatui-0.30`) and publishes a prerelease package to GitHub Packages: `0.2.0-alpha.[run]`.\n- Add GitHub Packages source (once):\n  - `dotnet nuget add source https://nuget.pkg.github.com/holo-q/index.json -n holo-q -u \u003cgh-username\u003e -p \u003cgh-token\u003e --store-password-in-clear-text`\n- Install alpha:\n  - `dotnet add package Ratatui.cs --version 0.2.0-alpha.* --source holo-q`\n- Notes: Scrollbar APIs default on; newer Table alignment options planned once ratatui 0.30 GA stabilizes.\n\n## Notes\n- Native library name: `ratatui_ffi` (`libratatui_ffi.so`/`.dylib` or `ratatui_ffi.dll`).\n- Loader search order: application base, `runtimes/\u003crid\u003e/native/`, dev `native/ratatui_ffi/target/{debug,release}`, or `RATATUI_FFI_DIR`.\n- Layout: simple C# helpers in `Ratatui.Layout`. For full parity, use Rect math or add your own helpers as needed.\n\n## Comparison\n- Spectre.Console: fantastic for rich console output (tables, markup, prompts). Ratatui.cs targets interactive, real‑time TUIs with a retained‑mode widget model, robust layout, and headless snapshot testing. If you need a dynamic dashboard or app‑like terminal UI, Ratatui.cs shines.\n- Terminal.Gui: pure C# and proven. Ratatui.cs leverages the high‑performance Rust Ratatui engine via FFI for fast rendering, a wide widget set, and deterministic headless tests. Choose Ratatui.cs for cross‑platform speed and CI‑friendly rendering.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholo-q%2FRatatui.cs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholo-q%2FRatatui.cs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholo-q%2FRatatui.cs/lists"}