Skip to content

feat(Select): add nullableValue prop - #2641

Merged
zernonia merged 1 commit into
unovue:v2from
yan-ad:feat/select-nullable-value
Jun 10, 2026
Merged

zernonia merged 1 commit into
unovue:v2from
yan-ad:feat/select-nullable-value

Conversation

@yan-ad

@yan-ad yan-ad commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #1975

❓ 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

Adds a nullableValue prop to SelectRoot so consumers can customize the hidden native select option value used when modelValue is nullish.

This keeps the existing default behavior ("") while allowing forms to submit another sentinel value such as "null" for server-side type handling.

  • Adds nullableValue?: string to SelectRootProps
  • Defaults nullableValue to an empty string for backward compatibility
  • Uses nullableValue for the nullish hidden <option> in the native bubble select
  • Documents the new prop in docs/content/meta/SelectRoot.md
  • Adds regression coverage for the hidden select option value

📸 Screenshots (if appropriate)

N/A

📝 Checklist

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

Summary by CodeRabbit

Release Notes

  • New Features

    • Added nullableValue prop to the Select component, allowing customization of the value assigned when no selection is made. Defaults to an empty string to maintain backward compatibility.
  • Documentation

    • Updated SelectRoot prop documentation to include the new nullableValue prop.
  • Tests

    • Added test validation for nullable value behavior in form contexts.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 087cbd58-bf99-44c1-93fa-09a9fc9ec52f

📥 Commits

Reviewing files that changed from the base of the PR and between edbeb93 and d716fbb.

📒 Files selected for processing (3)
  • docs/content/meta/SelectRoot.md
  • packages/core/src/Select/Select.test.ts
  • packages/core/src/Select/SelectRoot.vue

📝 Walkthrough

Walkthrough

This PR adds a nullableValue prop to SelectRoot that lets developers customize the value attribute of the hidden native select option when the model value is nullish. Previously hardcoded to an empty string, this change allows forms to submit custom values (e.g., "null") for better server-side type validation.

Changes

SelectRoot nullableValue Prop

Layer / File(s) Summary
Prop contract and template binding
packages/core/src/Select/SelectRoot.vue
SelectRootProps adds an optional nullableValue?: string prop that defaults to an empty string. The nullish-state <option> in the template now binds its value attribute to this prop instead of a hardcoded empty string.
Test coverage for nullable value
packages/core/src/Select/Select.test.ts
New test verifies that the hidden <select> option's value attribute matches the nullable-value prop when the Select's bound value is nullish.
Props documentation update
docs/content/meta/SelectRoot.md
SelectRoot props documentation is updated to include nullableValue, describing its purpose, type, and default value in both the data structure and the rendered table.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through the select dropdown,
Whispering "null" instead of empty strings,
Forms now speak the language servers understand,
Props dance freely where hardcodes once stood,
Flexibility blooms in nullable fields! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(Select): add nullableValue prop' clearly and concisely summarizes the main change: adding a new prop to the Select component.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #1975: adding an optional prop to control the value used when SelectRoot's modelValue is nullish, with backward-compatible default empty string.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the nullableValue prop feature: component prop addition, documentation update, and test coverage for the new functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented May 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: d716fbb

@zernonia
zernonia merged commit 4549d71 into unovue:v2 Jun 10, 2026
7 checks passed
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]: SelectRoot isNullable option value from props

2 participants