mantou-ui

中文文档
0.1.3发布于 2026/11/04MIT OR Apache-2.0ES Module构建来源已验证

Mantou: a native GUI framework for Bun + TypeScript

原始使用文档
文档目录3 节
  1. Try it
  2. Use it in an app
  3. Docs

Mantou

Native desktop apps in TypeScript, on Bun. Your app runs in a Bun Worker; a Rust core loaded with bun:ffi owns the window and draws the UI on the GPU with wgpu. No webview.

Early development. The threading model works on Linux, macOS and Windows. Solid-style JSX, flexbox layout, text, text input, scrolling, rounded corners and borders, clipping, presses, keys and the wheel work.

import { Text, View, createSignal, run } from "mantou-ui";

function App() {
  const [on, setOn] = createSignal(false);
  return (
    <View style={{ width: 120, height: 48, borderRadius: 8, justifyContent: "center", backgroundColor: on() ? "#16a34a" : "#4b5563" }} onPress={() => setOn(!on())}>
      <Text style={{ color: "#ffffff", fontWeight: 600, textAlign: "center" }}>{on() ? "On" : "Off"}</Text>
    </View>
  );
}

run(() => <App />);

Try it

Needs Bun 1.4.4 and Rust.

bun install
bun run build:core
bun run counter

For a bigger app, Mantou Mail is a three-pane mail client built on Mantou as a package.

Use it in an app

bun add mantou-ui
bunx mantou run src/main.tsx

The native core comes prebuilt for Linux (x64, arm64), macOS (arm64, x64) and Windows (x64). Elsewhere, or with mantou-ui from GitHub (bun add github:dunkbing/mantou), build it once with bunx mantou build-core (needs Rust).

Set "jsx": "preserve" and "jsxImportSource": "mantou-ui" in tsconfig.json, and preload mantou-ui/preload for bun test (bunfig.toml). Found a bug or need a feature? Open an issue.

Docs

The design, the protocol and test results are in website/ (Astro + Starlight, on Bun):

bun run docs

Working on the code, as a person or an agent? Start with AGENTS.md.

版本与发布记录

mantou-ui 共发布 4 个版本,首次发布于 2026/11/04;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.3latest2026/11/04今天
0.1.22026/11/041 天前
0.1.12026/11/041 天前
0.0.0-stage2026/11/041 天前

关于 mantou-ui 的常见问题

mantou-ui 是什么?

Mantou: a native GUI framework for Bun + TypeScript

如何安装 mantou-ui?

在项目目录运行 npm install mantou-ui,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 mantou,可以用 npx mantou 直接运行。

mantou-ui 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/mantou-ui 是否存在。

mantou-ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

mantou-ui 可以商用吗?

mantou-ui 使用 MIT OR Apache-2.0 许可。可在 MIT、Apache-2.0 中任选其一遵守。选择 MIT 时,宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

mantou-ui 还在维护吗?

最新版本 0.1.3 发布于 2026/11/04(今天);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/11/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。