English
Variable: text
ts
const text: (opts) => Promise<string | typeof CANCEL_SYMBOL>;Defined in: node_modules/.pnpm/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.d.mts:709
The text prompt accepts a single line of text.
Parameters
| Parameter | Type |
|---|---|
|
Returns
Promise<string | typeof CANCEL_SYMBOL>
See
https://bomb.sh/docs/clack/packages/prompts/#text-input
Example
ts
import { text } from "@clack/prompts";
const name = await text({
message: "What is your name?",
placeholder: "John Doe",
validate: (value) => {
if (!value || value.length < 2) return "Name must be at least 2 characters";
return undefined;
},
});
