# 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. ## Install Save as a script file and run: # Huh — Build Terminal Forms and Prompts in Go ## Quick Use ```bash go get github.com/charmbracelet/huh # minimal example cat < main.go package main import "github.com/charmbracelet/huh" func main() { var name string huh.NewInput().Title("Name?").Value(&name).Run() } GO go run main.go ``` ## 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 - https://github.com/charmbracelet/huh - https://charm.sh/blog/huh/ --- Source: https://tokrepo.com/en/workflows/asset-c11aa6f6 Author: Script Depot