Skip to content

feat(prompts): support maxItems in groupMultiselect#528

Merged
43081j merged 2 commits intobombshell-dev:mainfrom
bluwy:max-group-multiselect
May 8, 2026
Merged

feat(prompts): support maxItems in groupMultiselect#528
43081j merged 2 commits intobombshell-dev:mainfrom
bluwy:max-group-multiselect

Conversation

@bluwy
Copy link
Copy Markdown
Contributor

@bluwy bluwy commented May 7, 2026

What does this PR do?

If groupMultiselect have many items, it interferes with the rendering instead of scrolling itself. This PR implements the scrolling behaviour similar to multiselect using limitOptions.

Also, due to refactoring for limitOptions, if withGuide: false, the multiselect will no longer have an indent, which matches the styling of multiselect and other prompts.

Closes #526

Demo:

Screen.Recording.2026-05-07.at.8.09.23.PM.mov

Additional notes

  1. Much of the code and tests are referenced from multiselect
  2. limitOptions does not seem to handle new lines within options well, which could happen when groupPadding > 0 is set (which prepends new lines before group options). It assumes every option takes up one line when calculating the truncation. I did not fix this in the PR as I feel it's a separate issue.
  3. I thought about making the group option sticky, but I feel the scrolling could be a bit unpredictable and complex to work out.

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

🦋 Changeset detected

Latest commit: 70ae450

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

commit: 70ae450

@43081j
Copy link
Copy Markdown
Collaborator

43081j commented May 8, 2026

i will fix the problem with wrapping. it isn't only in limitOptions, its mostly in group multi-select itself.

gnarly stuff but i'll sort it in a follow up

@43081j 43081j merged commit 284677e into bombshell-dev:main May 8, 2026
9 checks passed
@bluwy bluwy deleted the max-group-multiselect branch May 8, 2026 10:12
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.

[Request] groupMultiselect scroll support

2 participants