Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Jan 29, 2026

closes #12020

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for external icon libraries in ButtonGroup component (FontAwesome, Material, custom CSS). Components now accept icon objects alongside traditional icon names for enhanced customization.
  • Documentation

    • Updated demo examples with external icon integration patterns and styling customization guidance.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

The PR enhances the BitButtonGroup component to support external icon libraries by introducing BitIconInfo? properties alongside existing string-based IconName properties. Icon resolution methods were refactored to prefer BitIconInfo objects with fallback to string-based icon names, enabling richer icon configuration across items and options without breaking existing functionality.

Changes

Cohort / File(s) Summary
Core Component Icon Resolution
src/BlazorUI/Bit.BlazorUI/Components/Buttons/ButtonGroup/BitButtonGroup.razor, src/BlazorUI/Bit.BlazorUI/Components/Buttons/ButtonGroup/BitButtonGroup.razor.cs
Refactored icon rendering from string-based GetItemIconName to BitIconInfo-based GetItemIcon. Introduced new helper methods for resolving icons with fallback logic: GetIcon, GetOnIcon, GetOffIcon for BitIconInfo, each with corresponding string-based variants. Updated null-checks and CSS class construction to support icon info objects.
Model Extensions
src/BlazorUI/Bit.BlazorUI/Components/Buttons/ButtonGroup/BitButtonGroupItem.cs, src/BlazorUI/Bit.BlazorUI/Components/Buttons/ButtonGroup/BitButtonGroupOption.cs, src/BlazorUI/Bit.BlazorUI/Components/Buttons/ButtonGroup/BitButtonGroupNameSelectors.cs
Added three new public properties to each model (Icon, OnIcon, OffIcon) of type BitIconInfo? with XML documentation. Extended BitButtonGroupNameSelectors with corresponding BitNameSelectorPair entries for icon resolution via selectors or property lookup.
Demo Infrastructure
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/BitButtonGroupDemo.razor.cs, src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/Operation.cs
Updated demo metadata to expose BitIconInfo entity representation and added operation model properties (Image, IconInfo, OnImage, OnIconInfo, OffImage, OffIconInfo) replacing string-based icon properties.
Demo Examples
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupCustomDemo.razor*, src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupItemDemo.razor*, src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupOptionDemo.razor*
Reorganized demo examples to showcase external icon support (FontAwesome, Material, custom CSS) alongside styling and RTL demonstrations. Updated internal data structures to use IconInfo properties and refactored selector usage from IconName to Icon within demo content.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 whiskers twitch with joy

Icons leap in vibrant dance,
BitIconInfo grants new chance!
FontAwesome, custom CSS so bright,
ButtonGroup shines with colored light! 🎨✨
External libraries now have their way,
This curious rabbit cheers hooray! 🥕

🚥 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%. 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 PR title clearly and specifically describes the main change: adding a new Icon parameter to BitButtonGroup component, matching the primary objective of implementing icon support.
Linked Issues check ✅ Passed The PR successfully implements the new Icon system for BitButtonGroup [#12020], enabling external icons through new BitIconInfo-based parameters across component classes and demo pages.
Out of Scope Changes check ✅ Passed All changes are focused on BitButtonGroup icon implementation. Demo updates and sample code additions are appropriate for documentation and testing of the new feature.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
32.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@msynk msynk merged commit 150c291 into bitfoundation:develop Jan 30, 2026
3 of 4 checks passed
@msynk msynk deleted the 12020-blazorui-buttongroup-icon branch January 30, 2026 05:55
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.

The new Icon implementation for the BitButtonGroup component

2 participants