feat(settings): render per-option icons in SelectField#97
Conversation
The `select` field variant now renders an option's `icon` (a lucide icon name, resolved via the existing LucideIcons convention) in both the dropdown items and the selected-value trigger. Options without an `icon` render exactly as before, so the change is additive and backward-compatible. Enables icon-style selects such as the vendor 'Verified Icon' picker.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughSelectField component now optionally displays Lucide icons for selected options and dropdown items. A new helper resolves icon names to components, while updated rendering logic inserts the icons alongside option labels in both the selection display and dropdown menu. ChangesSelectField Icon Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
The settings
selectfield variant (SelectField) now renders a per-option icon in both the dropdown items and the selected-value trigger.Icons are resolved via the existing convention used elsewhere in
fields.tsx(LucideIcons[name]), so an option just needsicon: '<LucideName>':Options without
iconrender exactly as before — the change is additive and backward-compatible. No primitive (SelectItem/SelectValue) changes were needed; the trigger CSS already sizes childsvgs.Why
Enables icon-style selects like the vendor "Verified Icon" picker (icon shown per row + for the current selection) without a bespoke custom field renderer in each consumer.
Notes / scope
currentColor, design-system consistency, and avoidingdangerouslySetInnerHTML); can be added later behind a real use case (image-URL is the safe extension).settings-formatter.tsalready preservesiconon options ({ ...opt, icon }), so no formatter change required.Testing
Verified live in Dokan admin settings (
verified_iconfield): icons render in the dropdown list and the selected trigger value; options without an icon are unaffected.Summary by CodeRabbit