···11+---
22+'@clack/prompts': patch
33+---
44+55+adding group to README.md
+33
packages/prompts/README.md
···120120// Do installation
121121s.stop('Installed via npm');
122122```
123123+124124+## Utilities
125125+126126+### Grouping
127127+128128+Grouping prompts together is a great way to keep your code organized. This accepts a JSON object with a name that can be used to reference the group later. The second argument is an optional but has a `onCancel` callback that will be called if the user cancels one of the prompts in the group.
129129+130130+```js
131131+import * as p from '@clack/prompts'
132132+133133+const group = await p.group({
134134+ name: () => p.text({ message: "What is your name?" }),
135135+ age: () => p.text({ message: "What is your age?" }),
136136+ color: ({ results }) => p.multiselect({
137137+ message: `What is your favorite color ${results.name}?`,
138138+ options: [
139139+ { value: 'red', label: 'Red' },
140140+ { value: 'green', label: 'Green' },
141141+ { value: 'blue', label: 'Blue' },
142142+ ],
143143+ })
144144+},
145145+{
146146+ // On Cancel callback that wraps the group
147147+ // So if the user cancels one of the prompts in the group this function will be called
148148+ onCancel: ({ results }) => {
149149+ p.cancel('Operation cancelled.')
150150+ process.exit(0)
151151+ }
152152+})
153153+154154+console.log(group.name, group.age, group.color)
155155+```