Skip to content

Commit

Permalink
docs(select): update usage description (#1203)
Browse files Browse the repository at this point in the history
  • Loading branch information
zonemeen committed Mar 22, 2023
1 parent bd58130 commit 061edf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/select/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ const answer = await select({
value: 'jspm',
disabled: true,
},
{
name: 'pnpm',
value: 'pnpm',
disabled: '(pnpm is not available)',
},
],
});
```
Expand All @@ -44,7 +49,7 @@ const answer = await select({
| Property | Type | Required | Description |
| -------- | --------- | -------- | ------------------------------ |
| message | `string` | yes | The question to ask |
| choices | `Array<{ value: string, name?: string, description?: string, disabled?: boolean }>` | yes | List of the available choices. The `value` will be returned as the answer, and used as display if no `name` is defined. Choices who're `disabled` will be displayed, but not selectable. The `description` will be displayed under the prompt when the cursor land over the choice. |
| choices | `Array<{ value: string, name?: string, description?: string, disabled?: boolean \| string }>` | yes | List of the available choices. The `value` will be returned as the answer, and used as display if no `name` is defined. Choices who're `disabled` will be displayed, but not selectable. The `description` will be displayed under the prompt when the cursor land over the choice. |
| 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. |

# License
Expand Down
5 changes: 5 additions & 0 deletions packages/select/demo.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import select from './src/index.mjs';
},
{ name: 'yarn', value: 'yarn', description: 'yarn is an awesome package manager' },
{ name: 'jspm', value: 'jspm', disabled: true },
{
name: 'pnpm',
value: 'pnpm',
disabled: '(pnpm is not available)',
},
],
});
console.log('Answer:', answer);
Expand Down

0 comments on commit 061edf3

Please sign in to comment.