Skip to content

Commit 36a7897

Browse files
committed
doc(@inquirer/search): Document the new config. Rel #1773
1 parent 8ccf932 commit 36a7897

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/search/README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,14 @@ const answer = await search({
8686

8787
## Options
8888

89-
| Property | Type | Required | Description |
90-
| -------- | ---------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
91-
| message | `string` | yes | The question to ask |
92-
| source | `(term: string \| void) => Promise<Choice[]>` | yes | This function returns the choices relevant to the search term. |
93-
| pageSize | `number` | no | By default, lists of choice longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once. |
94-
| validate | `Value => boolean \| string \| Promise<boolean \| string>` | no | On submit, validate the answer. When returning a string, it'll be used as the error message displayed to the user. Note: returning a rejected promise, we'll assume a code error happened and crash. |
95-
| theme | [See Theming](#Theming) | no | Customize look of the prompt. |
89+
| Property | Type | Required | Description |
90+
| ------------ | ---------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
91+
| message | `string` | yes | The question to ask |
92+
| source | `(term: string \| void) => Promise<Choice[]>` | yes | This function returns the choices relevant to the search term. |
93+
| pageSize | `number` | no | By default, lists of choice longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once. |
94+
| validate | `Value => boolean \| string \| Promise<boolean \| string>` | no | On submit, validate the answer. When returning a string, it'll be used as the error message displayed to the user. Note: returning a rejected promise, we'll assume a code error happened and crash. |
95+
| instructions | `{ navigation: string; pager: string }` | no | Customize the help instructions shown at the bottom of the prompt. |
96+
| theme | [See Theming](#Theming) | no | Customize look of the prompt. |
9697

9798
### `source` function
9899

@@ -136,6 +137,13 @@ Here's each property:
136137

137138
Choices can also be an array of string, in which case the string will be used both as the `value` and the `name`.
138139

140+
### `instructions` object
141+
142+
The `instructions` option allows you to customize the help text displayed at the bottom of the prompt:
143+
144+
- `navigation`: The instruction text shown when all choices fit within the page size (default: "Use arrow keys")
145+
- `pager`: The instruction text shown when there are more choices than the page size (default: "Use arrow keys to reveal more choices")
146+
139147
### Validation & autocomplete interaction
140148

141149
The validation within the search prompt acts as a signal for the autocomplete feature.

0 commit comments

Comments
 (0)