You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The autocomplete component lets a user filter a list by typing, then choose one option from the matching results. By default, matching uses each option's `label`, `hint`, and `value`. The result is the selected option's `value`.
129
+
130
+
```js
131
+
import { autocomplete } from'@clack/prompts';
132
+
133
+
constframework=awaitautocomplete({
134
+
message:'Pick a framework.',
135
+
placeholder:'Type to search...',
136
+
options: [
137
+
{ value:'next', label:'Next.js' },
138
+
{ value:'nuxt', label:'Nuxt' },
139
+
{ value:'sveltekit', label:'SvelteKit' },
140
+
{ value:'remix', label:'Remix' },
141
+
],
142
+
});
143
+
```
144
+
145
+
### Select Key
146
+
147
+
The `selectKey` component lets a user choose an option by pressing its single-character string `value` key directly.
148
+
149
+
```js
150
+
import { selectKey } from'@clack/prompts';
151
+
152
+
constaction=awaitselectKey({
153
+
message:'Pick an action.',
154
+
options: [
155
+
{ value:'d', label:'Deploy' },
156
+
{ value:'t', label:'Run tests' },
157
+
{ value:'q', label:'Quit' },
158
+
],
159
+
});
160
+
```
161
+
95
162
### Multi-Select
96
163
97
164
The `multiselect` component allows a user to choose many values from a list of options. The result is an array with all selected `value` props.
@@ -157,6 +224,19 @@ const bio = await multiline({
157
224
});
158
225
```
159
226
227
+
### Path
228
+
229
+
The path component offers filesystem path suggestions and returns the selected path as a string. When `directory: true` is set, only directories can be selected.
230
+
231
+
```js
232
+
import { path } from'@clack/prompts';
233
+
234
+
consttargetDir=awaitpath({
235
+
message:'Select an existing directory.',
236
+
directory:true,
237
+
});
238
+
```
239
+
160
240
### Spinner
161
241
162
242
The spinner component surfaces a pending action, such as a long-running download or dependency installation.
0 commit comments