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.

Router: Optimize AI Model Selection and Costs for Agentic Systems
September 28, 2026
The Weave-OS Router is an intelligent model router for agentic systems, optimizing AI model selection for every request. It acts as a drop-in proxy for major AI providers, routing prompts to the most suitable model in under 50ms. This solution helps users significantly cut costs, often by 40-70%, simply by changing an endpoint.
Memoh: An Open-Source Multi-Agent Platform with Dedicated AI Workspaces
September 26, 2026
Memoh is an innovative open-source multi-agent platform designed to provide each AI agent with its own dedicated cloud computer. This includes a filesystem, desktop, browser, network, and persistent long-term memory, ensuring agents remain online 24/7. Users can integrate their own API keys or host existing AI models, fostering a versatile and always-on environment for AI development and deployment.

llm-d Router: Intelligent Orchestration for Multi-Phase LLM Inference
September 25, 2026
The `llm-d-router` is a sophisticated Go service designed as an intelligent entry point for large language model (LLM) inference requests. It orchestrates complex, multi-phase LLM inference pipelines across specialized worker pools, routing requests through an Inference Gateway to disaggregated vLLM workers. By exposing OpenAI-compatible APIs, it simplifies integration and leverages Kubernetes for scalable, efficient deployments.

Inference Gateway: Unifying LLM Providers with a High-Performance API
September 25, 2026
Inference Gateway is an open-source, cloud-native, high-performance proxy server designed to unify access to various language model APIs. It provides a single OpenAI-compatible endpoint, simplifying interactions with multiple LLM providers, from local solutions like Ollama to major cloud platforms. This gateway enables seamless integration and management of diverse AI models, enhancing portability and data privacy.
Source repository
Open the original repository on GitHub.
18 counted GitHub visits