Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 17, 2026·2 min de lecture

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.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 96/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Prompt
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Huh Overview
Commande CLI universelle
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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires