Skip to content

feat(Select/Listbox/Combobox/Menu/ContextMenu/DropdownMenu/Menubar/ColorSwatchPicker): add slot prop to *Item and forceMount to *ItemIndicator - #2562

Merged
zernonia merged 4 commits into
unovue:v2from
kricsleo:feat/select-slot-props
Sep 29, 2026
Merged

zernonia merged 4 commits into
unovue:v2from
kricsleo:feat/select-slot-props

Conversation

@kricsleo

@kricsleo kricsleo commented Apr 1, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

resolves #2547

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📸 Screenshots (if appropriate)

📝 Checklist

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

Summary by CodeRabbit

  • New Features
    • Item components across Select, Listbox, Combobox, Menu, DropdownMenu, ContextMenu, Menubar, and ColorSwatchPicker now expose selection and checked states to slot content.
    • Select and Listbox item indicators support forceMount to remain mounted regardless of selection, with state information available for styling and animation.
  • Documentation
    • Updated component documentation to describe the new slot states and indicator mounting option.

@coderabbitai

coderabbitai Bot commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: unovue/reka-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 84fc7efb-8b01-4fd2-9473-1993becb49ab

📥 Commits

Reviewing files that changed from the base of the PR and between 750d77d and 4bf9b06.

📒 Files selected for processing (30)
  • docs/content/meta/ColorSwatchPickerItem.md
  • docs/content/meta/ColorSwatchPickerItemIndicator.md
  • docs/content/meta/ComboboxItem.md
  • docs/content/meta/ComboboxItemIndicator.md
  • docs/content/meta/ContextMenuCheckboxItem.md
  • docs/content/meta/ContextMenuRadioItem.md
  • docs/content/meta/DropdownMenuCheckboxItem.md
  • docs/content/meta/DropdownMenuRadioItem.md
  • docs/content/meta/ListboxItem.md
  • docs/content/meta/ListboxItemIndicator.md
  • docs/content/meta/MenubarCheckboxItem.md
  • docs/content/meta/MenubarRadioItem.md
  • docs/content/meta/SelectItem.md
  • docs/content/meta/SelectItemIndicator.md
  • packages/core/src/ColorSwatchPicker/ColorSwatchPickerItem.vue
  • packages/core/src/Combobox/ComboboxItem.vue
  • packages/core/src/ContextMenu/ContextMenuCheckboxItem.vue
  • packages/core/src/ContextMenu/ContextMenuRadioItem.vue
  • packages/core/src/DropdownMenu/DropdownMenu.test.ts
  • packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.vue
  • packages/core/src/DropdownMenu/DropdownMenuRadioItem.vue
  • packages/core/src/Listbox/Listbox.test.ts
  • packages/core/src/Listbox/ListboxItem.vue
  • packages/core/src/Listbox/ListboxItemIndicator.vue
  • packages/core/src/Menu/MenuCheckboxItem.vue
  • packages/core/src/Menubar/MenubarCheckboxItem.vue
  • packages/core/src/Menubar/MenubarRadioItem.vue
  • packages/core/src/Select/Select.test.ts
  • packages/core/src/Select/SelectItem.vue
  • packages/core/src/Select/SelectItemIndicator.vue

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


📝 Walkthrough

Walkthrough

Item components now expose selected or checked state through scoped slots. Select and Listbox indicators support optional force mounting and checked-state attributes. Documentation and tests cover these changes.

Changes

Item state slots and indicators

Layer / File(s) Summary
Selection and checked-state slot contracts
packages/core/src/Select/SelectItem.vue, packages/core/src/Listbox/ListboxItem.vue, packages/core/src/Menu/MenuCheckboxItem.vue, packages/core/src/Select/Select.test.ts, packages/core/src/Listbox/Listbox.test.ts, docs/content/meta/SelectItem.md, docs/content/meta/ListboxItem.md
SelectItem and ListboxItem expose selected in their default slots. MenuCheckboxItem exposes checked alongside model-value. Tests cover selection slot updates.
Scoped-slot forwarding through item wrappers
packages/core/src/Combobox/ComboboxItem.vue, packages/core/src/ColorSwatchPicker/ColorSwatchPickerItem.vue, packages/core/src/ContextMenu/*Item.vue, packages/core/src/DropdownMenu/*Item.vue, packages/core/src/Menubar/*Item.vue, packages/core/src/Menu/MenuRadioItem.vue, packages/core/src/DropdownMenu/DropdownMenu.test.ts, docs/content/meta/*Item.md
Combobox and ColorSwatchPicker forward selected state. ContextMenu, DropdownMenu, and Menubar checkbox and radio items forward checked state. Slot types and documentation describe the exposed values; DropdownMenu tests verify reactive slot values.
Force-mounted selection indicators
packages/core/src/Select/SelectItemIndicator.vue, packages/core/src/Listbox/ListboxItemIndicator.vue, packages/core/src/Select/Select.test.ts, packages/core/src/Listbox/Listbox.test.ts, docs/content/meta/*Indicator.md
Select and Listbox indicators add optional forceMount and use Presence to render when selected or force-mounted. They forward refs and render checked/unchecked data-state and aria-hidden attributes. Tests cover indicator mounting and state.

Priority: ➖ Normal

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

Change: Feature

Suggested reviewers: zernonia

Merge Risk: ⚪ Minimal · up to 4bf9b

The selected slot reports item state correctly in multiple-selection mode. No identified issue currently prevents merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 4bf9b

The new slot values reflect existing selection state, and mounting an unselected indicator requires an explicit option. No new security boundary or sensitive-data path was identified in the inspected components, though the broader security coverage is incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly reachable unselected indicator subtree is limited to consumers that opt into forceMount. It is mounted content, not an authorization or secrecy boundary.

Trust Boundaries and Controls

  • inferred — The new selected slot values provide read access to model-derived UI state; the inspected slot additions do not supply a setter or move selection authority into the slot consumer.

Hardening Proposals

  • proposed — Document that forceMount leaves unselected slot content in the DOM: aria-hidden does not make that content secret or necessarily prevent interaction with focusable descendants.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (27 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding slot props to item components and adding forceMount to item indicators across the listed components. It is specific enough despite being length…
Linked Issues check ✅ Passed The PR meets the coding objectives in #2547. SelectItem and ListboxItem expose a boolean selected slot prop. ComboboxItem forwards the shared listbox selection state. SelectItemIndicator and…
Out of Scope Changes check ✅ Passed The additional changes remain connected to the requested slot-state feature. ColorSwatchPicker and listbox-based components extend the same selected-item behavior. Menu, ContextMenu, DropdownMenu, and…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (27 skipped: 27 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

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

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Apr 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/reka-ui@2562

commit: 4bf9b06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/Select/SelectItem.vue`:
- Line 180: The slot in SelectItem.vue is passing the ComputedRef isSelected
instead of the raw boolean, so update the template to pass the unwrapped value
(use isSelected.value) to satisfy the slot type contract; locate the <slot
:selected="isSelected" /> usage in SelectItem.vue and replace it so consumers
receive a plain boolean, and audit similar patterns in Radio.vue and
TooltipRoot.vue where slot props are declared as unwrapped values but the Ref is
passed—change those to pass .value as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2db09e47-5527-4261-8bc2-81f8365c7af1

📥 Commits

Reviewing files that changed from the base of the PR and between 4383766 and dbd6103.

📒 Files selected for processing (2)
  • packages/core/src/Select/SelectItem.vue
  • packages/core/src/Select/SelectItemIndicator.vue

Comment thread packages/core/src/Select/SelectItem.vue Resolved
@DamianGlowala

DamianGlowala commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

@kricsleo thank you 💙 do you think we can apply this to combobox too (and any other select-like components I might have missed where such a feature makes sense)?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/Listbox/ListboxItemIndicator.vue`:
- Line 28: The Presence prop binding mixes forced and state-driven mounting;
change the Presence usage in ListboxItemIndicator.vue to pass present and
forceMount separately by setting :present="itemContext.isSelected.value" and
:forceMount="forceMount" so Presence can correctly handle transitions; locate
the Presence element (currently using :present="forceMount ||
itemContext.isSelected.value") and replace the expression with the two props,
and apply the same pattern to other components using the same combined
expression (e.g., Toast, Tooltip, Tabs, RadioGroup, Popover, Menu, HoverCard,
Dialog, Select, Checkbox, Collapsible, Combobox).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c446a63b-d950-423f-8e1b-56898d052469

📥 Commits

Reviewing files that changed from the base of the PR and between dbd6103 and 750d77d.

📒 Files selected for processing (11)
  • packages/core/src/ColorSwatchPicker/ColorSwatchPickerItem.vue
  • packages/core/src/Combobox/ComboboxItem.vue
  • packages/core/src/ContextMenu/ContextMenuCheckboxItem.vue
  • packages/core/src/ContextMenu/ContextMenuRadioItem.vue
  • packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.vue
  • packages/core/src/DropdownMenu/DropdownMenuRadioItem.vue
  • packages/core/src/Listbox/ListboxItem.vue
  • packages/core/src/Listbox/ListboxItemIndicator.vue
  • packages/core/src/Menu/MenuRadioItem.vue
  • packages/core/src/Menubar/MenubarCheckboxItem.vue
  • packages/core/src/Menubar/MenubarRadioItem.vue
✅ Files skipped from review due to trivial changes (1)
  • packages/core/src/Menubar/MenubarCheckboxItem.vue

@kricsleo kricsleo changed the title feat(Select): add selected slot prop to SelectItem and forceMount to SelectItemIndicator feat(Select/Listbox/Combobox/Menu/ContextMenu/DropdownMenu/Menubar/ColorSwatchPicker): add slot prop to *Item and forceMount to *ItemIndicator Apr 2, 2026
@kricsleo

kricsleo commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator Author

Added relevant features to more components.

@zernonia zernonia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice addition — fills a real gap. A few suggestions inline. One blocking item: forceMount leaks onto the DOM in both indicators. Also worth adding a test for the new Presence/forceMount behavior (e.g. in Select/Select.test.ts): indicator unmounts when unselected, stays mounted with forceMount, and forcemount doesn't leak to the DOM.

@zernonia zernonia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for extending this across the families! Before we merge:

  1. Please rebase on v2: ComboboxItem.vue now has a v-memo, just keep both it and the new v-slot.
  2. The forcemount attribute leaks onto the DOM in SelectItemIndicator/ListboxItemIndicator (v-bind="props"); binding as/as-child explicitly like CheckboxIndicator avoids it.
  3. Could the new indicators also emit data-state like CheckboxIndicator/MenuItemIndicator, so forceMount can drive animations?
  4. Let's settle on one slot prop name: the Menu radio items expose checked while checkbox items expose modelValue. Please also expose checked from MenuCheckboxItem and add defineSlots to the ContextMenu/DropdownMenu/Menubar wrappers.
  5. A small test (unmounts when unselected, stays mounted with forceMount, no forcemount attribute) and pnpm docs:gen.

Happy to help if you're short on time!

zernonia and others added 2 commits September 29, 2026 15:00
…ators

- stop forceMount leaking as a DOM attribute on Select/ListboxItemIndicator
- add data-state to Select/ListboxItemIndicator for forceMount animations
- expose checked from MenuCheckboxItem, matching radio items
- add defineSlots to SelectItem, ColorSwatchPickerItem and menu wrappers
- add tests and regenerate API docs

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@zernonia
zernonia merged commit 90c175a into unovue:v2 Sep 29, 2026
23 of 24 checks passed
zernonia added a commit to rastuhacode/reka-ui that referenced this pull request Oct 5, 2026
Resolve ColorSwatchPickerItem conflict: keep the item part surface and forward
the ListboxItem slot props added in unovue#2562.
Update the picker characterization test, which pinned the duplicate listener
call fixed by unovue#2938, and regenerate ColorSwatchPickerRoot meta.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

[Feature]: Expose selected on <SelectItem>/<SelectItemIndicator>

3 participants