ScriptsJul 27, 2026·3 min read

Clack — Beautiful CLI Prompts for Node.js

A set of prompt components for building interactive command-line interfaces with a polished look. Includes text inputs, select menus, confirmations, spinners, and multi-step flows with minimal API surface.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 29/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
CLI Tool
Install
Single
Trust
Trust: Established
Entrypoint
Clack
Safe staging command
npx -y tokrepo@latest install 2bfa972f-897b-11f1-9bc6-00163e2b0d79 --target codex

Stages files first; activation requires review of the staged README and plan.

Introduction

Clack is a library for building beautiful, interactive command-line prompts in Node.js. Created by Nate Moore (co-creator of Astro), it provides a set of composable prompt components with a polished terminal UI out of the box. Clack focuses on developer experience: prompts look professional, the API is minimal, and multi-step flows feel cohesive. Tools like the Astro CLI, SvelteKit, and Drizzle ORM use Clack for their interactive setup wizards.

What Clack Does

  • Provides styled prompt components: text, password, select, multiselect, confirm, and group
  • Renders spinners, progress indicators, and log messages with consistent styling
  • Chains prompts into multi-step wizards with intro/outro framing
  • Handles cancellation gracefully with SIGINT detection and cleanup
  • Offers a core layer for building custom prompt components with full rendering control

Architecture Overview

Clack is split into two packages: @clack/prompts (high-level components) and @clack/core (low-level primitives). The core package manages terminal state, cursor movement, input handling, and ANSI rendering. Prompt components are state machines that transition between idle, active, and submitted states. The rendering engine uses a double-buffered approach to minimize flicker, redrawing only changed lines on each keystroke.

Self-Hosting & Configuration

  • Install via npm: npm install @clack/prompts
  • Import prompt functions individually for tree-shaking
  • No configuration files needed; styling is built into the components
  • Works in Node.js 16+ and Bun
  • Use @clack/core to build custom prompt components with full terminal control

Key Features

  • Consistent visual design across all prompt types with Unicode box-drawing characters
  • Group prompts into logical sections with group() for multi-step wizards
  • Spinner component for long-running operations with start/stop/update methods
  • Cancellation handling with isCancel() check after each prompt
  • Minimal API surface: each prompt is a single async function call

Comparison with Similar Tools

  • Inquirer.js — The established choice with many prompt types and plugins; Clack offers a more modern look and smaller API
  • Enquirer — Feature-rich with custom prompt types; Clack prioritizes visual consistency and simplicity
  • Prompts — Lightweight alternative; Clack adds polished styling and multi-step flow support
  • Commander.js — Argument parser, not a prompt library; Commander handles flags while Clack handles interactive input
  • Ink — React-based terminal UI framework; Clack is simpler for standard prompt flows without React overhead

FAQ

Q: Can I customize the look of Clack prompts? A: The high-level @clack/prompts package has a fixed visual style. For custom rendering, use @clack/core to build prompt components with your own ANSI styling.

Q: Does Clack work with TypeScript? A: Yes. Clack is written in TypeScript and all prompt functions have full type definitions, including generic types for select options.

Q: How does Clack handle user cancellation (Ctrl+C)? A: Each prompt returns a special cancel symbol when the user presses Ctrl+C. Use the isCancel() helper to detect this and exit gracefully.

Q: Which projects use Clack? A: Astro CLI, SvelteKit, Drizzle ORM, and several other developer tools use Clack for their interactive setup and configuration wizards.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets