展示 HN:Giggles – 一个开箱即用的 React TUI 框架
Show HN: Giggles – A batteries-included React framework for TUIs

原始链接: https://github.com/zion-off/giggles

## Giggles:用于终端应用的 React 框架 Giggles 是一个功能完善的 React 框架,旨在简化终端应用程序的构建。它基于 Ink 构建,消除了常见的 TUI(文本用户界面)复杂性,例如焦点管理、输入处理和屏幕导航,让开发者专注于构建功能。 受到 Charmbracelet 的启发,Giggles 提供了一个丰富的组件库、直观的钩子(例如 `useFocusScope` 和 `useNavigation`)以及终端实用程序,用于执行诸如运行 shell 命令和显示带有语法高亮的 Markdown 等任务。 主要特性包括组件级别的按键处理(无需全局处理程序!)、简单的导航 API、内置的按键绑定注册表以提高可访问性,以及与 Vim 或 Less 等外部程序无缝集成的能力。Giggles 还可以动态适应终端调整大小和焦点变化,提供一致且可定制的用户体验。 更多信息和演示请访问 [giggles.zzzzion.com](https://giggles.zzzzion.com)。

## Giggles:一个用于终端UI的新React框架 开发者ajz317发布了“Giggles”,一个旨在简化文本用户界面(TUI)创建的React框架。Giggles解决了现有库(如Ink)中存在的复杂性,自动管理焦点和输入路由,无需手动协调。 该框架拥有15个预构建的UI组件(包括列表、输入框和模态框),具有可定制的渲染props,并包含进程控制(例如启动外部程序如Vim)和内置主题与按键绑定注册表等功能。它也兼容React 19。 一位评论者jitl强调了对更好Ink工具的需求,并指出OpenTUI是一个替代方案,同时分享了在使用Ink构建视口组件时遇到的令人沮丧的渲染问题。 你可以在[https://giggles.zzzzion.com](https://giggles.zzzzion.com)找到演示和文档,并可以使用`npx create-giggles-app`快速启动一个新项目。
相关文章

原文

CI CD docs

giggles

giggles is a batteries-included react framework for building terminal apps. built on ink, it handles focus, input routing, screen navigation, and theming out of the box so you can skip the plumbing and build.

inspired by the charmbracelet ecosystem, it comes with a rich set of UI components, hooks for focus and navigation management, and terminal utilities for things like running shell commands.

  • each component owns its keys — a text input inside a list inside a panel all work independently, with unhandled keys naturally passing up to the right parent. no global input handler, no coordination code
  • navigate between views with a simple API; the previously focused component is restored when you return
  • a full set of hooks and components — useFocusScope, useFocusNode, FocusTrap, useNavigation, and more — for building any interaction pattern without reimplementing the plumbing
  • built-in keybinding registry so your app can always show users what keys do what, in the current context — context-aware and accessible via a hook
  • a component library covering most TUI use cases, from text inputs and autocomplete to virtual lists for large datasets — with sensible defaults and render props for full customization
  • render markdown in the terminal, with full formatting and syntax-highlighted code block and diff support
  • hand off terminal control to external programs like vim or less and reclaim it cleanly when they exit, or spawn processes and stream their output directly into your UI
  • a consistent look out of the box, customizable from a single theme object

to get started, run

see giggles.zzzzion.com for API documentation and live demos.

select multi-select markdown text-input viewport codeblock confirm spinner modal paginator autocomplete command-palette virtual-list badge panel

suspend the UI, hand off the terminal to an external program like vim or less, and resume cleanly when it exits

spawn a child process and stream its stdout/stderr output into your UI — with support for colored output via a pty

reactively track the terminal's current dimensions (rows and columns), updating on resize

detect when the terminal window gains or loses focus

联系我们 contact @ memedata.com