Skip to content

Commit dccb07c

Browse files
docs: add example for groupMultiselect prompt to README file. (#215)
Co-authored-by: James Garbutt <[email protected]>
1 parent 4237986 commit dccb07c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/prompts/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,28 @@ const additionalTools = await multiselect({
110110
});
111111
```
112112

113+
It is also possible to select multiple items arranged into hierarchy by using `groupMultiselect`:
114+
115+
```js
116+
import { groupMultiselect } from '@clack/prompts';
117+
118+
const basket = await groupMultiselect({
119+
message: 'Select your favorite fruits and vegetables:',
120+
options: {
121+
fruits: [
122+
{ value: 'apple', label: 'apple' },
123+
{ value: 'banana', label: 'banana' },
124+
{ value: 'cherry', label: 'cherry' },
125+
],
126+
vegetables: [
127+
{ value: 'carrot', label: 'carrot' },
128+
{ value: 'spinach', label: 'spinach' },
129+
{ value: 'potato', label: 'potato' },
130+
]
131+
}
132+
});
133+
```
134+
113135
### Spinner
114136

115137
The spinner component surfaces a pending action, such as a long-running download or dependency installation.

0 commit comments

Comments
 (0)