Closed
Description
Environment
- OS:macOS, Windows
- Node Version: Bun v1.2.13
- Package:
@clack/prompts
- Package Version:
^0.10.1
Describe the bug
When using the text(...)
component with a placeholder value and the validate
function returns an error or string, the CLI doubles the placeholder value.
To Reproduce
https://stackblitz.com/edit/node-zrbpxtzw?file=index.js
The code is so short, I'll also put it here:
import { text } from '@clack/prompts';
(async () => {
const name = await text({
message: "What's your project name?",
placeholder: 'my-project',
validate: () => 'try again',
});
})();
Steps to reproduce the behavior:
- Run the file
- Just hit
enter
when the prompt shows - The prompt errors correctly but fills with double what the placeholder value is
Expected behavior
When the prompt errors out, it should retain whatever value was there already (including none).
Additional Information
Screen.Recording.2025-05-16.at.10.51.54.AM.mov
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Needs triage