4.0.1 • Published 2 months ago

@inquirer/expand v4.0.1

Weekly downloads
24
License
MIT
Repository
github
Last release
2 months ago

@inquirer/expand

Compact single select prompt. Every option is assigned a shortcut key, and selecting h will expand all the choices and their descriptions.

Expand prompt closed Expand prompt expanded

Installation

npm install @inquirer/expand

yarn add @inquirer/expand

Usage

import expand from '@inquirer/expand';

const answer = await expand({
  message: 'Conflict on file.js',
  default: 'y',
  choices: [
    {
      key: 'y',
      name: 'Overwrite',
      value: 'overwrite',
    },
    {
      key: 'a',
      name: 'Overwrite this one and all next',
      value: 'overwrite_all',
    },
    {
      key: 'd',
      name: 'Show diff',
      value: 'diff',
    },
    {
      key: 'x',
      name: 'Abort',
      value: 'abort',
    },
  ],
});

Options

PropertyTypeRequiredDescription
messagestringyesThe question to ask
choicesArray<{ key: string, name: string, value?: string }>yesArray of the different allowed choices. The h/help option is always provided by default
defaultstringnoDefault choices to be selected. (value must be one of the choices key)
expandedbooleannoExpand the choices by default
themeSee ThemingnoCustomize look of the prompt.

Theming

You can theme a prompt by passing a theme object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.

type Theme = {
  prefix: string;
  spinner: {
    interval: number;
    frames: string[];
  };
  style: {
    answer: (text: string) => string;
    message: (text: string) => string;
    error: (text: string) => string;
    defaultAnswer: (text: string) => string;
    highlight: (text: string) => string;
  };
};

License

Copyright (c) 2023 Simon Boudrias (twitter: @vaxilart) Licensed under the MIT license.

4.0.1

2 months ago

4.0.0

3 months ago

2.2.0

4 months ago

3.0.1

3 months ago

3.0.0

3 months ago

2.3.0

4 months ago

2.1.9

7 months ago

2.1.16

5 months ago

2.1.17

5 months ago

2.1.14

6 months ago

2.1.15

5 months ago

2.1.12

6 months ago

2.1.13

6 months ago

2.1.10

6 months ago

2.1.11

6 months ago

2.1.18

5 months ago

2.1.19

5 months ago

2.1.21

5 months ago

2.1.22

5 months ago

2.1.20

5 months ago

2.1.8

7 months ago

2.1.7

7 months ago

2.1.6

8 months ago

2.1.5

8 months ago

2.1.4

8 months ago

2.1.3

8 months ago

2.1.2

9 months ago

2.1.1

9 months ago

2.1.0

10 months ago

2.0.2

10 months ago

2.0.1

10 months ago

2.0.0

11 months ago

1.1.16

11 months ago

1.1.15

11 months ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago

0.0.28-alpha.0

2 years ago

0.0.27-alpha.0

2 years ago

0.0.26-alpha.0

2 years ago

0.0.21-alpha.0

3 years ago

0.0.22-alpha.0

2 years ago

0.0.24-alpha.0

2 years ago

0.0.23-alpha.0

2 years ago

0.0.19-alpha.0

3 years ago

0.0.20-alpha.0

3 years ago

0.0.18-alpha.0

3 years ago

0.0.17-alpha.0

3 years ago

0.0.16-alpha.0

3 years ago

0.0.15-alpha.0

4 years ago

0.0.14-alpha.0

4 years ago

0.0.13-alpha.0

4 years ago

0.0.12-alpha.0

4 years ago

0.0.11-alpha.0

4 years ago

0.0.10-alpha.0

5 years ago

0.0.9-alpha.0

5 years ago

0.0.7-alpha.0

5 years ago

0.0.6-alpha.0

5 years ago

0.0.5-alpha.0

6 years ago