From dccb07ccfc70472c50ad87fb09c521bc105552cd Mon Sep 17 00:00:00 2001 From: Dmytro Shulha <48155493+Dmytro-Shulha@users.noreply.github.com> Date: Sun, 13 Apr 2025 20:36:30 +0300 Subject: [PATCH] docs: add example for groupMultiselect prompt to README file. (#215) Co-authored-by: James Garbutt <43081j@users.noreply.github.com> --- packages/prompts/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/prompts/README.md b/packages/prompts/README.md index 2e297ee..b3ab473 100644 --- a/packages/prompts/README.md +++ b/packages/prompts/README.md @@ -110,6 +110,28 @@ const additionalTools = await multiselect({ }); ``` +It is also possible to select multiple items arranged into hierarchy by using `groupMultiselect`: + +```js +import { groupMultiselect } from '@clack/prompts'; + +const basket = await groupMultiselect({ + message: 'Select your favorite fruits and vegetables:', + options: { + fruits: [ + { value: 'apple', label: 'apple' }, + { value: 'banana', label: 'banana' }, + { value: 'cherry', label: 'cherry' }, + ], + vegetables: [ + { value: 'carrot', label: 'carrot' }, + { value: 'spinach', label: 'spinach' }, + { value: 'potato', label: 'potato' }, + ] + } +}); +``` + ### Spinner The spinner component surfaces a pending action, such as a long-running download or dependency installation. -- 2.51.2