Skip to content

feat(SelectMenu/InputMenu): add a limit for visible selected labels - #7480

Open
mateusznarowski wants to merge 1 commit into
nuxt:v4from
mateusznarowski:feat/menu-selected-label-limit
Open

mateusznarowski wants to merge 1 commit into
nuxt:v4from
mateusznarowski:feat/menu-selected-label-limit

Conversation

@mateusznarowski

@mateusznarowski mateusznarowski commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #6759

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Add an optional maxSelectedLabels prop to SelectMenu and InputMenu in multiple mode. When the selection exceeds the limit, the component shows a localized count such as “5 selected”. Set the limit to 0 to show the count whenever at least one item is selected.

The #selection-summary slot exposes count so apps can show context-specific text such as “5 countries selected”.

InputMenu keeps its two-step Backspace behavior while the summary is visible. With an empty input, the first press highlights the summary and the second removes the last selected item.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ui Ready Ready Preview Nov 23, 2026 4:48pm UTC
ui-repl Ready Ready Preview Nov 23, 2026 4:48pm UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Client output of the apps in test/bundle that changed, compared to the base branch.

Fixture JS (gzip) CSS (gzip)
nuxt 121.5 kB (+21 B, +0.0%) 29.2 kB (+52 B, +0.2%)
nuxt-detection 121.5 kB (+21 B, +0.0%) 10.8 kB
nuxt-full 911.7 kB (+0.4 kB, +0.0%) 29.4 kB (+52 B, +0.2%)
vue 98.9 kB (+19 B, +0.0%) 27.4 kB (+49 B, +0.2%)
vue-detection 98.9 kB (+19 B, +0.0%) 9.1 kB
Raw sizes
Fixture JS CSS
nuxt 345.0 kB (+39 B, +0.0%) 212.2 kB (+0.2 kB, +0.1%)
nuxt-detection 345.0 kB (+39 B, +0.0%) 61.6 kB
nuxt-full 2855.7 kB (+1.1 kB, +0.0%) 212.5 kB (+0.2 kB, +0.1%)
vue 291.3 kB (+39 B, +0.0%) 215.0 kB (+0.2 kB, +0.1%)
vue-detection 291.3 kB (+39 B, +0.0%) 59.0 kB

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

InputMenu and SelectMenu add a maxSelectedLabels prop and a selection-summary slot for multiple-selection mode. When the selected-item count exceeds the configured non-negative limit, each component displays the custom summary or a translated default. InputMenu hides individual tags while keeping them mounted. Locale messages, component tests, and documentation are also added.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: Minimal · up to ed8c8 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the feature added: an optional limit on visible selected labels in SelectMenu and InputMenu. The changeset adds maxSelectedLabels to both components, a selection-summary slot, locale s…
Linked Issues check Passed Issue #6759 has one direct, open, coding-related scope. Its requirements are: (1) an optional maxSelectedLabels prop on SelectMenu and InputMenu; (2) a summary, such as '5 items selected', when …
Out of Scope Changes check Passed All changes connect to issue #6759 or to its direct implementation:
- SelectMenu.vue and InputMenu.vue: the prop, the slot, and the summary rendering.
- src/runtime/types/locale.ts and the local…
Description check Passed The description states that the PR adds an optional maxSelectedLabels prop to SelectMenu and InputMenu in multiple mode. It also explains the count display at the limit, the selection-summary slot exp…
Full details: Title check

Explanation

The title names the feature added: an optional limit on visible selected labels in SelectMenu and InputMenu. The changeset adds maxSelectedLabels to both components, a selection-summary slot, locale strings, and tests, so the title matches the main change. Wording follows the conventional commit style used by the author.

Full details: Linked Issues check

Explanation

Issue #6759 has one direct, open, coding-related scope. Its requirements are: (1) an optional maxSelectedLabels prop on SelectMenu and InputMenu; (2) a summary, such as '5 items selected', when the selection exceeds the limit; (3) a slot or render function to customise the summary text. The changes in the reviewed head implement each requirement:

  • Requirement 1: maxSelectedLabels?: number is added to SelectMenuProps and InputMenuProps. The limit is applied as Math.max(0, maxSelectedLabels).
  • Requirement 2: In multiple mode, when the selected count exceeds the limit, both components show a summary. The default text is the localised selection.summary message, added to the locale files and to the Messages type. SelectMenu.vue replaces the joined values with the summary. InputMenu.vue hides the tags but keeps them mounted.
  • Requirement 3: A selection-summary slot receives count and ui. It is declared in SelectMenuSlots and InputMenuSlots.
  • Tests: SelectMenu.spec.ts and InputMenu.spec.ts cover the summary threshold, the equal-to-limit case, and the custom slot.
    The assessment relies on the whole-PR summary and the spec and documentation descriptions. I did not inspect the source hunks directly. Snapshot files were excluded by the ignored-files rule, so they were not used as evidence.
Full details: Out of Scope Changes check

Explanation

All changes connect to issue #6759 or to its direct implementation:

  • SelectMenu.vue and InputMenu.vue: the prop, the slot, and the summary rendering.
  • src/runtime/types/locale.ts and the locale files: the selection.summary message needed for the default localised text. The issue asks for localised count text, so these support the requirement.
  • src/theme/input-menu.ts: a selectionSummary theme slot for styling the summary. This supports the summary display.
  • InputMenu two-step Backspace behaviour: not named in the issue. It is a supporting behaviour. Without it, Backspace would remove hidden selected items with no visible feedback. It is limited to the summary-visible state and does not change other behaviour.
  • Documentation in input-menu.md and select-menu.md: documents the new prop and slot.
    No unrelated functional change was identified. The SelectMenu documentation section is marked 'Soon'. This is a documentation status choice and does not indicate out-of-scope code.
Full details: Description check

Explanation

The description states that the PR adds an optional maxSelectedLabels prop to SelectMenu and InputMenu in multiple mode. It also explains the count display at the limit, the selection-summary slot exposing count, and the two-step Backspace behaviour in InputMenu. The changeset includes these components, the locale messages, and the documentation, so the description matches the changes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8fa4bcaa-88f5-44ee-8797-ce1b0a5a825a
Commits

Reviewing files that changed from the base of the PR and between bf93b9c and ed8c83e.

Files ignored due to path filters: 2

  • test/components/__snapshots__/InputMenu-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/InputMenu.spec.ts.snap is excluded by !**/*.snap
Files selected for processing: 71

  • docs/content/docs/2.components/input-menu.md
  • docs/content/docs/2.components/select-menu.md
  • src/runtime/components/InputMenu.vue
  • src/runtime/components/SelectMenu.vue
  • src/runtime/locale/ar.ts
  • src/runtime/locale/az.ts
  • src/runtime/locale/be.ts
  • src/runtime/locale/bg.ts
  • src/runtime/locale/bn.ts
  • src/runtime/locale/ca.ts
  • src/runtime/locale/ckb.ts
  • src/runtime/locale/cs.ts
  • src/runtime/locale/da.ts
  • src/runtime/locale/de.ts
  • src/runtime/locale/de_ch.ts
  • src/runtime/locale/el.ts
  • src/runtime/locale/en.ts
  • src/runtime/locale/es.ts
  • src/runtime/locale/et.ts
  • src/runtime/locale/eu.ts
  • src/runtime/locale/fa_ir.ts
  • src/runtime/locale/fi.ts
  • src/runtime/locale/fr.ts
  • src/runtime/locale/gl.ts
  • src/runtime/locale/he.ts
  • src/runtime/locale/hi.ts
  • src/runtime/locale/hr.ts
  • src/runtime/locale/hu.ts
  • src/runtime/locale/hy.ts
  • src/runtime/locale/id.ts
  • src/runtime/locale/is.ts
  • src/runtime/locale/it.ts
  • src/runtime/locale/ja.ts
  • src/runtime/locale/ka.ts
  • src/runtime/locale/kk.ts
  • src/runtime/locale/km.ts
  • src/runtime/locale/ko.ts
  • src/runtime/locale/ky.ts
  • src/runtime/locale/lb.ts
  • src/runtime/locale/lo.ts
  • src/runtime/locale/lt.ts
  • src/runtime/locale/lv.ts
  • src/runtime/locale/mn.ts
  • src/runtime/locale/ms.ts
  • src/runtime/locale/nb_no.ts
  • src/runtime/locale/nl.ts
  • src/runtime/locale/pl.ts
  • src/runtime/locale/pt.ts
  • src/runtime/locale/pt_br.ts
  • src/runtime/locale/ro.ts
  • src/runtime/locale/ru.ts
  • src/runtime/locale/sk.ts
  • src/runtime/locale/sl.ts
  • src/runtime/locale/sq.ts
  • src/runtime/locale/sr.ts
  • src/runtime/locale/sr_latn.ts
  • src/runtime/locale/sv.ts
  • src/runtime/locale/tg.ts
  • src/runtime/locale/th.ts
  • src/runtime/locale/tr.ts
  • src/runtime/locale/ug_cn.ts
  • src/runtime/locale/uk.ts
  • src/runtime/locale/ur.ts
  • src/runtime/locale/uz.ts
  • src/runtime/locale/vi.ts
  • src/runtime/locale/zh_cn.ts
  • src/runtime/locale/zh_tw.ts
  • src/runtime/types/locale.ts
  • src/theme/input-menu.ts
  • test/components/InputMenu.spec.ts
  • test/components/SelectMenu.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@codspeed

codspeed Bot commented Nov 23, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 37.53%

1 warning

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
✅ 32 untouched benchmarks
⏩ 10 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ navigation-menu (~31 slots) 974.8 µs 708.8 µs +37.53%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mateusznarowski:feat/menu-selected-label-limit (ed8c83e) with v4 (bf93b9c)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@7480

commit: ed8c83e

This branch was successfully deployed

2 active deployments
Preview – ui — ed8c83eb Deployed Nov 23, 2026 by vercel[bot]
Preview – ui-repl — ed8c83eb Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for limiting visible selected item labels in SelectMenu and InputMenu

1 participant