Skip to content

feat: box prompt #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

feat: box prompt #363

wants to merge 7 commits into from

Conversation

43081j
Copy link
Collaborator

@43081j 43081j commented Aug 3, 2025

Adds a new box prompt which works like so:

prompts.box(
  'This is a message',
  'This is a title',
  {
    rounded: true
  }
);

For reviewers

Feedback i'd like on this:

  • Does includePrefix make sense? Basically its to tell the box to output the usual | bar before it, so if it is part of a group of prompts it will fit in. If you set it to false (the default), it won't output this
  • This is very similar to the note prompt. It may be argued that we should just add the functionality to that instead of having a separate prompt

Copy link

changeset-bot bot commented Aug 3, 2025

🦋 Changeset detected

Latest commit: f2936c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Aug 3, 2025

@example/basic@example/changesets

npm i https://pkg.pr.new/bombshell-dev/clack/@clack/core@363
npm i https://pkg.pr.new/bombshell-dev/clack/@clack/prompts@363

commit: 858361c

@43081j 43081j requested a review from dreyfus92 August 3, 2025 21:25
Copy link
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so cool, but wouldn't it be cooler if you could add a color prop to modify the color border of the box? or even the title?

thank you for adding tests btw, LGTM 🤘🏻

@43081j
Copy link
Collaborator Author

43081j commented Aug 4, 2025

i think you're right but i want to avoid some kind of borderColor setting

maybe we should do what note does and provide a format option, and a formatBorder option or some such thing

basically so you bring your own formatting, like formatBorder: (symbol) => styleText('blue', symbol)

@43081j
Copy link
Collaborator Author

43081j commented Aug 9, 2025

i've added a formatBorder option, so you can do this:

box('some message', 'some title', {
  formatBorder: styleText.bind(null, 'red'), // or picocolors.red
});

Copy link
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's ship it 🤘🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants