feat(select): auto-render options from items prop when children omitted#97
Open
invisal wants to merge 3 commits intocloudflare:mainfrom
Open
feat(select): auto-render options from items prop when children omitted#97invisal wants to merge 3 commits intocloudflare:mainfrom
invisal wants to merge 3 commits intocloudflare:mainfrom
Conversation
Add automatic option rendering to Select component to reduce boilerplate
for simple use cases while maintaining full flexibility for complex scenarios.
Changes:
- Add renderOptionsFromItems() helper function to auto-generate Select.Option
elements from items prop (supports object map and array formats)
- Auto-render children when items provided but children omitted
- Simplify 4 demo functions to showcase concise API
- Update documentation page with simplified code examples
- Regenerate component registry with updated examples
Benefits:
- 50% code reduction for simple select cases
- More intuitive API - items prop now feels complete
- Zero breaking changes - explicit children always override
- Maintains flexibility for custom rendering scenarios
Examples:
Before: <Select items={{...}}><Select.Option>...</Select.Option></Select>
After: <Select items={{...}} />
Null values in items array are typically used for placeholders and should not be rendered as actual options. This fix ensures that when auto-rendering options from the items prop, null values are filtered out. This prevents duplicate placeholder options when using both the placeholder prop and null values in the items array.
commit: |
Contributor
Docs PreviewCommit: |
Contributor
mattrothenberg
approved these changes
Feb 17, 2026
Collaborator
mattrothenberg
left a comment
There was a problem hiding this comment.
LGTM! I might be mis-reading the diff, but it looks like there's some unrelated table example changes in this patch too?
Contributor
Author
That's |
Brayden
approved these changes
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





















Summary
Adds automatic option rendering to the Select component to reduce boilerplate for simple use cases while maintaining full flexibility for complex scenarios.
When the
itemsprop is provided without explicit children, the Select component now automatically generatesSelect.Optionelements. This makes the API more intuitive and reduces code by ~50% for simple select cases.Changes
renderOptionsFromItems()helper function to auto-generateSelect.Optionelements fromitemsprop{ key: "Label" }[{ value, label }]itemsis provided but children are omittedBenefits
itemsprop now feels complete on its ownExamples
Before (Verbose)
After (Concise)
Files Changed
packages/kumo/src/components/select/select.tsx(+35 lines)packages/kumo-docs-astro/src/components/demos/SelectDemo.tsx(refactored)packages/kumo-docs-astro/src/pages/components/select.astro(-31 lines)packages/kumo/ai/component-registry.json(auto-updated)packages/kumo/ai/component-registry.md(auto-updated)Stats: 5 files changed, 104 insertions(+), 76 deletions(-)
Testing