huh: Build Interactive Terminal Forms and Prompts in Go
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
`huh` is a simple yet powerful Go library from Charmbracelet designed for creating interactive forms and prompts directly within the terminal. It offers a wide range of field types, including text inputs, multi-selects, and confirmations, all easily configurable. The library also boasts features like accessibility support, customizable themes, and seamless integration with Bubble Tea applications, making it an excellent choice for enhancing command-line interfaces.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
huh is a robust and user-friendly Go library developed by Charmbracelet, specifically engineered for building interactive forms and prompts within the terminal. It empowers developers to create engaging command-line interfaces with a variety of input fields, making CLI applications more dynamic and user-friendly. Whether you need to gather simple text input, allow users to select from a list, or confirm actions, huh provides an elegant solution.
Key features of huh include:
- A comprehensive set of field types:
Input,Text,Select,MultiSelect, andConfirm. - Support for multi-page forms using groups.
- Built-in validation for fields.
- An accessible mode for screen readers.
- Customizable themes to match your application's aesthetic.
- Seamless integration with Charmbracelet's
Bubble Teaframework. - Dynamic forms that adapt based on user input.
Installation
Getting started with huh is straightforward. You can add it to your Go project using the standard go get command:
go get github.com/charmbracelet/huh
Examples
huh makes it easy to create both simple prompts and complex multi-page forms. Here's a quick example demonstrating a single input field:
package main
import (
"fmt"
"log"
"github.com/charmbracelet/huh"
)
func main() {
var name string
err := huh.NewInput().
Title("What’s your name?").
Value(&name).
Run() // this is blocking...
if err != nil {
log.Fatal(err)
}
fmt.Printf("Hey, %s!\n", name)
}
For more elaborate scenarios, huh allows you to construct multi-group forms with various field types. Below is an excerpt from a burger ordering form, showcasing Select, MultiSelect, Input, Text, and Confirm fields:
package main
import (
"errors"
"fmt"
"log"
"github.com/charmbracelet/huh"
)
var (
burger string
toppings []string
sauceLevel int
name string
instructions string
discount bool
)
func main() {
form := huh.NewForm(
huh.NewGroup(
huh.NewSelect[string]().
Title("Choose your burger").
Options(
huh.NewOption("Charmburger Classic", "classic"),
huh.NewOption("Chickwich", "chickwich"),
huh.NewOption("Fishburger", "fishburger"),
huh.NewOption("Charmpossible™ Burger", "charmpossible"),
).
Value(&burger),
huh.NewMultiSelect[string]().
Title("Toppings").
Options(
huh.NewOption("Lettuce", "lettuce").Selected(true),
huh.NewOption("Tomatoes", "tomatoes").Selected(true),
huh.NewOption("Jalapeños", "jalapeños"),
huh.NewOption("Cheese", "cheese"),
huh.NewOption("Vegan Cheese", "vegan cheese"),
huh.NewOption("Nutella", "nutella"),
).
Limit(4).
Value(&toppings),
huh.NewSelect[int]().
Title("How much Charm Sauce do you want?").
Options(
huh.NewOption("None", 0),
huh.NewOption("A little", 1),
huh.NewOption("A lot", 2),
).
Value(&sauceLevel),
),
huh.NewGroup(
huh.NewInput().
Title("What’s your name?").
Value(&name).
Validate(func(str string) error {
if str == "Frank" {
return errors.New("Sorry, we don’t serve customers named Frank.")
}
return nil
}),
huh.NewText().
Title("Special Instructions").
CharLimit(400).
Value(&instructions),
huh.NewConfirm().
Title("Would you like 15% off?").
Value(&discount),
),
)
err := form.Run()
if err != nil {
log.Fatal(err)
}
if !discount {
fmt.Println("What? You didn’t take the discount?!\n")
}
}
huh also supports dynamic forms, where fields can change based on previous inputs, and an accessible mode for improved usability with screen readers.
Why Use huh?
huh stands out for several reasons, making it an excellent choice for developers looking to enhance their CLI applications:
- Simplicity and Power: It offers a clean and intuitive API that allows for the rapid development of complex interactive forms.
- Rich User Experience: By bringing interactive forms to the terminal,
huhelevates the user experience of command-line tools beyond simple text prompts. - Flexibility: With a variety of field types, validation capabilities, and dynamic form features,
huhcan adapt to almost any input requirement. - Accessibility: The dedicated accessible mode ensures that your CLI applications are usable by a wider audience, including those who rely on screen readers.
- Customization: Theming options allow you to tailor the look and feel of your forms to perfectly match your brand or application's style.
- Bubble Tea Integration: For those building more extensive Terminal User Interface (TUI) applications with
Bubble Tea,huhintegrates seamlessly, acting as atea.Modelfor advanced control.
Links
- GitHub Repository: https://github.com/charmbracelet/huh
- Go Documentation: https://pkg.go.dev/github.com/charmbracelet/huh?tab=doc
- Charmbracelet: https://charm.sh
Related repositories
Similar repositories that may be relevant next.

no-mistakes: AI-Driven Git Proxy for Flawless Pull Requests
June 30, 2026
no-mistakes is an innovative Git proxy that streamlines the pull request workflow by ensuring code quality before it reaches your remote. It uses an AI-driven validation pipeline in a disposable worktree, automatically applying safe fixes and escalating complex issues for human review. This tool helps developers maintain clean, high-quality codebases and open perfect PRs effortlessly.
Gogcli: Google Workspace Management from Your Terminal
June 24, 2026
Gogcli is a powerful command-line interface for Google Workspace, allowing users to manage Gmail, Calendar, Drive, Docs, Sheets, and many other services directly from their terminal. It is designed for both interactive use and robust automation, providing predictable output, agent safety features, and support for multiple accounts.

PinchTab: High-Performance Browser Automation for AI Agents
June 21, 2026
PinchTab is a high-performance browser automation bridge and multi-instance orchestrator, designed to give AI agents direct control over Chrome. Built in Go, it offers advanced stealth injection, real-time dashboards, and token-efficient web interaction. It supports both headless and headed modes, enabling robust and secure automation workflows for various applications.

Multigres: Vitess Adaptation for Scalable Postgres Databases
June 3, 2026
Multigres is an innovative project that adapts Vitess for use with PostgreSQL, aiming to bring advanced sharding and scalability features to Postgres environments. Currently in early development, it offers a promising solution for managing large-scale Postgres deployments. Users can explore its capabilities and contribute to its growth.
Source repository
Open the original repository on GitHub.