Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 17, 2026·2 min de lectura

Huh — Build Terminal Forms and Prompts in Go

A Go library for building interactive terminal forms with inputs, selects, confirms, and file pickers, powered by the Bubble Tea TUI framework.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 96/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Prompt
Instalación
Single
Confianza
Confianza: Established
Entrada
Huh Overview
Comando CLI universal
npx tokrepo install c11aa6f6-51a7-11f1-9bc6-00163e2b0d79

Introduction

Huh is a Go library by Charm for building rich interactive forms in the terminal. It provides pre-built components like text inputs, selects, multi-selects, confirms, and file pickers that render beautifully using the Bubble Tea framework underneath.

What Huh Does

  • Renders multi-step terminal forms with keyboard navigation
  • Provides input, select, multi-select, confirm, and text area fields
  • Supports theming via Lip Gloss styles for consistent branding
  • Validates user input with custom or built-in validators
  • Works in accessible mode for screen readers and simple terminals

Architecture Overview

Huh builds on Charm's Bubble Tea TUI framework. Each form field is a Bubble Tea model with its own Update/View cycle. A Form groups fields into ordered steps, managing focus transitions and collecting results into bound Go variables via pointer references.

Self-Hosting & Configuration

  • Add to your module: go get github.com/charmbracelet/huh
  • No external runtime or daemon required
  • Customize appearance with huh.NewTheme() and Lip Gloss styles
  • Set accessible mode with huh.NewForm().WithAccessible(true) for CI environments
  • Compose fields into groups and groups into multi-page forms

Key Features

  • Declarative API: define forms with a builder pattern in a few lines
  • Keyboard-driven UX with Vim-style and arrow key navigation
  • Built-in spinner component for async operations during form flow
  • Supports piped input and non-interactive environments gracefully
  • Lightweight with no CGo dependencies

Comparison with Similar Tools

  • Bubble Tea — lower-level TUI framework; Huh is a form abstraction on top of it
  • Survey (Go) — similar form library but less visually polished
  • promptui — simpler prompts, fewer field types, less active maintenance
  • Inquirer.js — Node.js equivalent; Huh brings the same UX to Go
  • tview — full TUI widget toolkit; heavier than what forms need

FAQ

Q: Can Huh forms run in CI without a TTY? A: Yes. Enable accessible mode or pipe values via stdin for non-interactive runs.

Q: Does Huh support custom validation? A: Yes. Each field accepts a Validate(func(string) error) callback.

Q: Can I theme the form to match my CLI brand? A: Yes. Huh exposes a full theming API using Lip Gloss styles for colors, borders, and spacing.

Q: Is Huh compatible with Windows terminals? A: Yes. It works on Windows Terminal, PowerShell, and cmd via Bubble Tea's cross-platform rendering.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados