# caique/inquirer/prompts

> Every export of caique/inquirer/prompts, with its signature and doc comment: Separator, checkbox, editor, confirm, input, number and 5 more, plus 25 types.

Source: https://caique.interlace.tools/docs/api/inquirer/prompts

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

`caique/inquirer/prompts` — `@inquirer/prompts`' prompts, over `caique/inquirer`'s loop.

```ts
import { Separator, checkbox, editor, … } from 'caique/inquirer/prompts';
```

## Constants

### checkbox

Ask for any of `choices`.

```ts
const checkbox: <Value>(config: CheckboxConfig<Value>, context?: import("./inquirer.js").Context) => import("./inquirer.js").CancelablePromise<Value[]>;
```

### confirm

```ts
const confirm: import("./inquirer.js").Prompt<boolean, ConfirmConfig>;
```

### editor

```ts
const editor: import("./inquirer.js").Prompt<string, EditorConfig>;
```

### expand

```ts
const expand: <Value>(config: ExpandConfig<Value>, context?: import("./inquirer.js").Context) => import("./inquirer.js").CancelablePromise<Value>;
```

### input

```ts
const input: import("./inquirer.js").Prompt<string, InputConfig>;
```

### number

```ts
const number: <Required extends boolean>(config: NumberConfig<Required>, context?: import("./inquirer.js").Context) => import("./inquirer.js").CancelablePromise<Required extends true ? number : number | undefined>;
```

### password

```ts
const password: import("./inquirer.js").Prompt<string, PasswordConfig>;
```

### rawlist

```ts
const rawlist: <Value>(config: RawlistConfig<Value>, context?: import("./inquirer.js").Context) => import("./inquirer.js").CancelablePromise<Value>;
```

### search

```ts
const search: <Value>(config: SearchConfig<Value>, context?: import("./inquirer.js").Context) => import("./inquirer.js").CancelablePromise<Value>;
```

### select

Ask for one of `choices`.

```ts
const select: <Value>(config: SelectConfig<Value>, context?: import("./inquirer.js").Context) => import("./inquirer.js").CancelablePromise<Value>;
```

## Interfaces

### CheckboxConfig

`checkbox`'s configuration, as `@inquirer/checkbox` declares it.

```ts
interface CheckboxConfig<Value> {
    message: string;
    prefix?: string;
    pageSize?: number;
    choices: readonly (Value | Choice<Value> | Separator)[];
    loop?: boolean;
    required?: boolean;
    validate?: (choices: readonly NormalizedChoice<Value>[]) => boolean | string | Promise<string | boolean>;
    theme?: PartialTheme<CheckboxTheme>;
    shortcuts?: {
        all?: string | null;
        invert?: string | null;
    };
}
```

### CheckboxTheme

What `checkbox` adds to the core theme.

```ts
interface CheckboxTheme {
    icon: {
        checked: string;
        unchecked: string;
        cursor: string;
        disabledChecked: string;
        disabledUnchecked: string;
    };
    style: {
        disabled: (text: string) => string;
        renderSelectedChoices: <T>(selectedChoices: readonly NormalizedChoice<T>[], allChoices: readonly Item<T>[]) => string;
        description: (text: string) => string;
        keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
    };
    i18n: {
        disabledError: string;
    };
}
```

### Choice

A choice as a caller may write it.

```ts
interface Choice<Value> {
    value: Value;
    name?: string;
    checkedName?: string;
    description?: string;
    short?: string;
    disabled?: boolean | string;
    checked?: boolean;
    type?: never;
}
```

### ConfirmConfig

`confirm`'s config, as the incumbent declares it.

```ts
interface ConfirmConfig {
    message: string;
    default?: boolean | undefined;
    transformer?: (value: boolean) => string;
    theme?: PartialDeep<Theme & ConfirmTheme>;
}
```

### ConfirmTheme

What `confirm` adds to the shared theme.

```ts
interface ConfirmTheme {
    /** The words that answer yes and no, matched by prefix; `y`, `n`, `yes` and `no` always work too. */
    keywords: {
        yes: string;
        no: string;
        error: (keywords: {
            yes: string;
            no: string;
        }) => string;
    };
    /** How the default's letter is drawn in the `Y/n` hint. */
    style: {
        confirmDefault: (text: string) => string;
    };
}
```

### EditorConfig

`editor`'s config, as the incumbent declares it.

```ts
interface EditorConfig {
    message: string;
    default?: string | undefined;
    postfix?: string;
    waitForUserInput?: boolean;
    validate?: (value: string) => boolean | string | Promise<string | boolean>;
    file?: EditorFileOptions;
    theme?: PartialDeep<Theme & EditorTheme>;
}
```

### EditorFileOptions

Where the temporary file goes and what it is called, as `@inquirer/external-editor` takes it.

```ts
interface EditorFileOptions {
    prefix?: string;
    postfix?: string;
    mode?: number;
    dir?: string;
}
```

### EditorTheme

What `editor` adds to the shared theme.

```ts
interface EditorTheme {
    validationFailureMode: 'keep' | 'clear';
    style: {
        loadingMessage: () => string;
        waitingMessage: (enterKey: string) => string;
    };
}
```

### ExpandConfig

`expand`'s config, as the incumbent declares it.

```ts
interface ExpandConfig<Value> {
    message: string;
    choices: readonly (Separator | {
        key: ExpandKey;
        name: Value & string;
        value?: never;
    } | ExpandChoice<Value>)[];
    default?: ExpandKey | 'h';
    expanded?: boolean;
    theme?: PartialDeep<Theme>;
}
```

### InputConfig

`input`'s config, as the incumbent declares it.

```ts
interface InputConfig {
    message: string;
    default?: string | undefined;
    prefill?: 'tab' | 'editable';
    required?: boolean;
    transformer?: (value: string, flags: {
        isFinal: boolean;
    }) => string;
    validate?: (value: string) => Verdict;
    theme?: PartialDeep<Theme & InputTheme>;
    pattern?: RegExp;
    patternError?: string;
}
```

### InputTheme

What `input` adds to the shared theme.

```ts
interface InputTheme {
    validationFailureMode: 'keep' | 'clear';
}
```

### NormalizedChoice

A choice once the prompt has filled in every field.

```ts
interface NormalizedChoice<Value> {
    value: Value;
    name: string;
    checkedName: string;
    description?: string;
    short: string;
    disabled: boolean | string;
    checked: boolean;
}
```

### NumberConfig

`number`'s config, as the incumbent declares it.

```ts
interface NumberConfig<Required extends boolean = boolean> {
    message: string;
    default?: number | undefined;
    min?: number;
    max?: number;
    step?: number | 'any';
    required?: Required;
    validate?: (value: Required extends true ? number : number | undefined) => Verdict;
    theme?: PartialDeep<Theme>;
}
```

### PasswordConfig

`password`'s config, as the incumbent declares it.

```ts
interface PasswordConfig {
    message: string;
    mask?: boolean | string;
    toggleMask?: boolean;
    validate?: (value: string) => Verdict;
    theme?: PartialDeep<Theme & PasswordTheme>;
}
```

### PasswordTheme

What `password` adds to the shared theme.

```ts
interface PasswordTheme {
    style: {
        maskedText: string;
        keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
    };
}
```

### RawlistChoice

A `rawlist` choice as a caller writes it.

```ts
interface RawlistChoice<Value> {
    value: Value;
    name?: string;
    short?: string;
    key?: string;
    description?: string;
}
```

### RawlistConfig

`rawlist`'s config, as the incumbent declares it.

```ts
interface RawlistConfig<Value> {
    message: string;
    choices: readonly (Value | RawlistChoice<Value> | Separator)[];
    loop?: boolean;
    theme?: PartialDeep<Theme & RawlistTheme>;
    default?: NoInfer<Value>;
}
```

### RawlistTheme

What `rawlist` adds to the shared theme.

```ts
interface RawlistTheme {
    style: {
        description: (text: string) => string;
    };
}
```

### SearchConfig

`search`'s config, as the incumbent declares it.

```ts
interface SearchConfig<Value> {
    message: string;
    source: (term: string | undefined, opt: {
        signal: AbortSignal;
    }) => readonly (Value | SearchChoice<Value> | Separator)[] | Promise<readonly (Value | SearchChoice<Value> | Separator)[]>;
    validate?: (value: Value) => boolean | string | Promise<string | boolean>;
    pageSize?: number;
    default?: NoInfer<Value>;
    initialValue?: string;
    theme?: PartialDeep<Theme & SearchTheme>;
}
```

### SearchTheme

What `search` adds to the shared theme.

```ts
interface SearchTheme {
    icon: {
        cursor: string;
    };
    style: {
        disabled: (text: string) => string;
        searchTerm: (text: string) => string;
        description: (text: string) => string;
        keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
    };
}
```

### SelectConfig

`select`'s configuration, as `@inquirer/select` declares it.

```ts
interface SelectConfig<Value> {
    message: string;
    choices: readonly (Value | Omit<Choice<Value>, 'checked' | 'checkedName'> | Separator)[];
    pageSize?: number;
    loop?: boolean;
    default?: NoInfer<Value>;
    theme?: PartialTheme<SelectTheme>;
}
```

### SelectTheme

What `select` adds to the core theme.

```ts
interface SelectTheme {
    icon: {
        cursor: string;
    };
    style: {
        disabled: (text: string) => string;
        description: (text: string) => string;
        keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
    };
    i18n: {
        disabledError: string;
    };
    indexMode: 'hidden' | 'number';
}
```

## Types

### ExpandChoice

An `expand` choice: a key, and a value, a name, or both.

```ts
type ExpandChoice<Value> = {
    key: ExpandKey;
    value: Value;
} | {
    key: ExpandKey;
    name: string;
    value: Value;
};
```

### ExpandKey

The keys `expand` accepts: a letter or a digit, `h` aside, because `h` is help.

```ts
type ExpandKey = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
```

### SearchChoice

A `search` choice as a caller writes it: `select`'s, without `checkbox`'s fields.

```ts
type SearchChoice<Value> = Omit<Choice<Value>, 'checked' | 'checkedName'>;
```

## Re-exported

Documented on the page of the entry point that declares them.

| Export | Kind | Documented in |
| :-- | :-- | :-- |
| `Separator` | class | [`caique/inquirer`](/docs/api/inquirer#separator) |
