Skip to content

prompts ​

Interfaces ​

InterfaceDescription

AutocompleteMultiSelectOptions

Options for the autocompleteMultiselect prompt

AutocompleteOptions

‐

BoxOptions

Options for the box prompt.

ClackSettings

‐

CommonOptions

‐

ConfirmOptions

Options for the confirm prompt.

DateOptions

Options for the date prompt.

GroupMultiSelectOptions

Options for the groupMultiselect prompt.

LimitOptionsParams

Options for the limitOptions function.

LogMessageOptions

‐

MultiLineOptions

Options for the multiline prompt

MultiSelectOptions

‐

NoteOptions

‐

PasswordOptions

Options for the password prompt

PathOptions

Options for the path prompt.

ProgressOptions

‐

ProgressResult

‐

PromptGroupOptions

Options for the group utility.

SelectKeyOptions

‐

SelectOptions

‐

SpinnerOptions

‐

SpinnerResult

‐

TaskLogCompletionOptions

‐

TaskLogMessageOptions

‐

TaskLogOptions

‐

TextOptions

Options for the text prompt

Type Aliases ​

Type AliasDescription

BoxAlignment

Alignment for content or titles within the box.

DateFormat

‐

Option

‐

PromptGroup

A group of prompts to be displayed sequentially, with each prompt receiving the results of all previous prompts in the group.

PromptGroupAwaitedReturn

The return type of a PromptGroup. Resolves all prompt results, excluding the cancel symbol.

Task

‐

Variables ​

VariableDescription

autocomplete

The autocomplete prompt combines a text input with a searchable list of options. It's perfect for when you have a large list of options and want to help users find what they're looking for quickly.

See

https://bomb.sh/docs/clack/packages/prompts/#autocomplete

Example

ts
import { 
autocomplete
} from "@clack/prompts";
const
framework
= await
autocomplete
({
message
: "Search for a framework",
options
: [
{
value
: "next",
label
: "Next.js",
hint
: "React framework" },
{
value
: "astro",
label
: "Astro",
hint
: "Content-focused" },
{
value
: "svelte",
label
: "SvelteKit",
hint
: "Compile-time framework" },
{
value
: "remix",
label
: "Remix",
hint
: "Full stack framework" },
{
value
: "nuxt",
label
: "Nuxt",
hint
: "Vue framework" },
],
placeholder
: "Type to search...",
maxItems
: 5,
});

autocompleteMultiselect

The autocompleteMultiselect prompt combines the search functionality of autocomplete with the ability to select multiple options.

See

https://bomb.sh/docs/clack/packages/prompts/#autocomplete-multiselect

Example

ts
import { 
autocompleteMultiselect
} from "@clack/prompts";
const
frameworks
= await
autocompleteMultiselect
({
message
: "Select frameworks",
options
: [
{
value
: "next",
label
: "Next.js",
hint
: "React framework" },
{
value
: "astro",
label
: "Astro",
hint
: "Content-focused" },
{
value
: "svelte",
label
: "SvelteKit",
hint
: "Compile-time framework" },
{
value
: "remix",
label
: "Remix",
hint
: "Full stack framework" },
{
value
: "nuxt",
label
: "Nuxt",
hint
: "Vue framework" },
],
placeholder
: "Type to search...",
maxItems
: 5,
});

box

Renders a customizable box around text content. It's similar to note but offers more styling options.

See

https://bomb.sh/docs/clack/packages/prompts/#box

Example

ts
import { 
box
} from "@clack/prompts";
box
("This is the content of the box", "Box Title", {
contentAlign
: "center",
titleAlign
: "center",
width
: "auto",
rounded
: true,
});

cancel

The cancel function defines an interruption of an interaction and therefore its end.

See

https://bomb.sh/docs/clack/packages/prompts/#cancel

Example

ts
import { 
cancel
} from "@clack/prompts";
import
process
from "node:process";
cancel
("Installation canceled");
process
.exit(1);

CANCEL_SYMBOL

‐

confirm

The confirm prompt accepts a yes or no choice, returning a boolean value corresponding to the user's selection.

See

https://bomb.sh/docs/clack/packages/prompts/#confirmation

Example

ts
import { 
confirm
} from "@clack/prompts";
const
shouldProceed
= await
confirm
({
message
: "Do you want to continue?",
});

date

The date prompt provides an interactive date picker, allowing users to navigate between year, month, and day segments and increment/decrement values using keyboard controls.

See

https://bomb.sh/docs/clack/packages/prompts/#date-input

Example

ts
import { 
date
} from "@clack/prompts";
const
birthday
= await
date
({
message
: "Pick your birthday",
minDate
: new
Date
("1900-01-01"),
initialValue
: new
Date
(),
maxDate
: new
Date
(),
});

group

The group utility provides a consistent way to combine a series of prompts, combining each answer into one object. Each prompt receives the results of all previously completed prompts, and are displayed sequentially.

See

https://bomb.sh/docs/clack/packages/prompts/#group

Example

ts
import { 
group
,
text
,
password
} from "@clack/prompts";
const
account
= await
group
({
email
: () =>
text
({
message
: "What is your email address?",
}),
username
: ({
results
}) =>
text
({
message
: "What is your username?",
placeholder
:
results
.email?.replace(/@.+$/, "").toLowerCase() ?? "",
}),
password
: () =>
password
({
message
: "Define your password",
}), });

groupMultiselect

The groupMultiselect prompt extends the multiselect prompt to allow arranging distinct Multi-Selects, whilst keeping all of them interactive.

See

https://bomb.sh/docs/clack/packages/prompts/#group-multiselect

Example

ts
import { 
groupMultiselect
} from "@clack/prompts";
const
result
= await
groupMultiselect
({
message
: "Define your project",
options
: {
"Testing": [ {
value
: "Jest",
hint
: "JavaScript testing framework" },
{
value
: "Playwright",
hint
: "End-to-end testing" },
], "Language": [ {
value
: "js",
label
: "JavaScript",
hint
: "Dynamic typing" },
{
value
: "ts",
label
: "TypeScript",
hint
: "Static typing" },
], }, });

intro

The intro function defines the beginning of an interaction.

See

https://bomb.sh/docs/clack/packages/prompts/#intro

Example

ts
import { 
intro
} from "@clack/prompts";
intro
("Welcome to clack");

isCI

‐

isTTY

‐

limitOptions

Trims an option list to what fits the terminal, while keeping the active option (cursor) visible using a Clack style sliding window.

See

https://bomb.sh/docs/clack/packages/prompts/#limitoptions

Example

ts
import { 
limitOptions
} from "@clack/prompts";
import {
styleText
} from "node:util";
const
options
= ["apple", "banana", "cherry", "date"];
const
lines
=
limitOptions
({
options
,
cursor
: 2,
maxItems
: 8,
style
: (
opt
,
active
) =>
active
?
styleText
("cyan",
opt
) :
styleText
("dim",
opt
),
});

log

‐

multiline

The multi-line prompt accepts multiple lines of text input. By default, pressing Enter twice submits the input.

See

https://bomb.sh/docs/clack/packages/prompts/#multi-line-text

Example

ts
import { 
multiline
} from "@clack/prompts";
const
bio
= await
multiline
({
message
: "Enter your bio",
placeholder
: "Tell us about yourself...",
showSubmit
: true,
});

multiselect

‐

MULTISELECT_INSTRUCTIONS

‐

note

‐

outro

The outro function defines the end of an interaction.

See

https://bomb.sh/docs/clack/packages/prompts/#outro

Example

ts
import { 
outro
} from "@clack/prompts";
outro
("All operations are finished");

password

The password prompt behaves like the text prompt, but the input is masked.

See

https://bomb.sh/docs/clack/packages/prompts/#password-input

Example

ts
import { 
password
} from "@clack/prompts";
const
result
= await
password
({
message
: "Enter your password",
});

path

The path prompt extends autocomplete to provide file and directory suggestions.

See

https://bomb.sh/docs/clack/packages/prompts/#path-selection

Example

ts
import { 
path
} from "@clack/prompts";
const
result
= await
path
({
message
: "Select a file:",
root
: process.cwd(),
directory
: false,
});

S_BAR

‐

S_BAR_END

‐

S_BAR_END_RIGHT

‐

S_BAR_H

‐

S_BAR_START

‐

S_BAR_START_RIGHT

‐

S_CHECKBOX_ACTIVE

‐

S_CHECKBOX_INACTIVE

‐

S_CHECKBOX_SELECTED

‐

S_CONNECT_LEFT

‐

S_CORNER_BOTTOM_LEFT

‐

S_CORNER_BOTTOM_RIGHT

‐

S_CORNER_TOP_LEFT

‐

S_CORNER_TOP_RIGHT

‐

S_ERROR

‐

S_INFO

‐

S_PASSWORD_MASK

‐

S_RADIO_ACTIVE

‐

S_RADIO_INACTIVE

‐

S_STEP_ACTIVE

‐

S_STEP_CANCEL

‐

S_STEP_ERROR

‐

S_STEP_SUBMIT

‐

S_SUCCESS

‐

S_WARN

‐

select

‐

SELECT_INSTRUCTIONS

‐

selectKey

‐

settings

‐

spinner

‐

stream

‐

symbol

‐

symbolBar

‐

taskLog

Renders a log which clears on success and remains on failure

tasks

Define a group of tasks to be executed

text

The text prompt accepts a single line of text.

See

https://bomb.sh/docs/clack/packages/prompts/#text-input

Example

ts
import { 
text
} from "@clack/prompts";
const
name
= await
text
({
message
: "What is your name?",
placeholder
: "John Doe",
validate
: (
value
) => {
if (!
value
||
value
.length < 2) return "Name must be at least 2 characters";
return
undefined
;
}, });

unicode

‐

unicodeOr

‐

Functions ​

FunctionDescription

formatInstructionFooter

‐

isCancel

‐

progress

‐

updateSettings

‐

Released under the MIT License