Skip to content

Add new Icon parameters to BitDropMenu (#12105)#12106

Merged
msynk merged 1 commit intobitfoundation:developfrom
msynk:12105-blazorui-dropmenu-new-icons
Feb 18, 2026
Merged

Add new Icon parameters to BitDropMenu (#12105)#12106
msynk merged 1 commit intobitfoundation:developfrom
msynk:12105-blazorui-dropmenu-new-icons

Conversation

@msynk
Copy link
Member

@msynk msynk commented Feb 18, 2026

closes #12105

Summary by CodeRabbit

  • New Features
    • DropMenu now supports external icon libraries (FontAwesome, Bootstrap Icons) in addition to built-in Fluent UI icons
    • Enhanced icon customization options for both header and dropdown icons
    • Added detailed examples and documentation for integrating third-party icon libraries

@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

Walkthrough

The BitDropMenu component is refactored to support external icon libraries through new BitIconInfo properties (Icon and ChevronDownIcon), while maintaining built-in Fluent UI icon support via string properties (IconName and ChevronDownIconName). Icon rendering now uses BitIconInfo.From() for dynamic CSS class generation. Demo and documentation are updated accordingly.

Changes

Cohort / File(s) Summary
Component Implementation
src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor, src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs
Refactored icon handling to use BitIconInfo objects alongside string-based icon names. Changed ChevronDownIcon from string to BitIconInfo?, added new BitIconInfo? Icon property, added ChevronDownIconName and IconName string properties. Updated rendering logic to use BitIconInfo.From() and GetCssClasses() for dynamic CSS generation.
Demo & Documentation
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor, src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.cs, src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.samples.cs
Updated demo component usage to use ChevronDownIconName parameter, added external icon library examples (FontAwesome and Bootstrap Icons), expanded documentation with BitIconInfo parameter descriptions, and updated sample code blocks to reflect API changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hop! The icons now leap free,
From strings to BitIconInfo spree!
External fonts take center stage,
While Fluent icons turn a new page.

🚥 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 accurately summarizes the main change: adding new Icon parameters to the BitDropMenu component, which is the core focus of the PR.
Linked Issues check ✅ Passed The PR successfully implements new Icon parameters (Icon, IconName, ChevronDownIcon, ChevronDownIconName) enabling external icon support across BitDropMenu component icons.
Out of Scope Changes check ✅ Passed All changes are directly scoped to adding Icon parameters to BitDropMenu; demo updates and documentation changes support the feature implementation appropriately.
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 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor (1)

119-119: External stylesheets loaded inline within demo content.

The <link> elements for Font Awesome and Bootstrap Icons are placed directly in the demo body rather than in <head>. While this works and is acceptable for a demo page, it's worth noting that in production usage, users should be guided to load these in the document head. Consider adding a brief note or comment in the demo UI.

Also applies to: 143-143

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor`
at line 119, The demo currently injects external stylesheets inline (the <link>
tags) in BitDropMenuDemo.razor; update the demo to either move those stylesheet
includes into the app shell (e.g., index.html/_Host) for production or, if you
want to keep them in the demo page, add a short visible note or an HTML comment
next to the existing <link> tags in BitDropMenuDemo.razor explaining "For
production, load Font Awesome and Bootstrap Icons in the document <head> (e.g.,
index.html/_Host) instead of in-page links" so users are guided correctly;
reference the inline <link> elements in BitDropMenuDemo.razor when making this
change.
src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor (1)

36-39: Consider extracting the rotation class from the icon name string for clearer intent.

The fallback "ChevronRight bit-ico-r90" embeds a CSS rotation class within the icon name, which couples styling to the naming convention. While BitIconInfo.From correctly handles this and produces bit-icon bit-icon--ChevronRight bit-ico-r90, the pattern is fragile—changes to GetCssClasses() logic (e.g., sanitizing names) could break it silently.

Use BitIconInfo.Css() for explicit external CSS, or apply the rotation class separately on the <i> element, similar to the pattern in _BitNavChild.razor where the class is conditional and separate.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor` around
lines 36 - 39, The fallback icon name embeds a rotation class ("ChevronRight
bit-ico-r90") via BitIconInfo.From in BitDropMenu.razor which couples styling to
the name; instead, change to provide only the icon name via ChevronDownIconName
(or "ChevronRight") to BitIconInfo.From (used by chevronIcon) and move the
rotation class out to the <i> element by adding the rotation CSS (e.g.,
bit-ico-r90) via Classes?.ChevronDown or a conditional class alongside
Styles?.ChevronDown; optionally use BitIconInfo.Css() to supply any external
icon CSS rather than embedding it in the name so GetCssClasses() only reflects
the logical icon name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs`:
- Around line 35-46: Breaking change: the BitDropMenu and BitMenuButton
parameters changed ChevronDownIcon from string? to BitIconInfo?, causing compile
errors for existing string usages; update usages to either use the new
ChevronDownIconName string parameter for Fluent UI icon names or pass a
BitIconInfo instance to ChevronDownIcon (e.g., BitIconInfo factory) where
external/icon-library icons are needed. Locate the parameters in BitDropMenu
(ChevronDownIcon, ChevronDownIconName) and BitMenuButton and replace any markup
attributes like ChevronDownIcon="SomeName" with ChevronDownIconName="SomeName"
or ChevronDownIcon="@BitIconInfo.YourFactory(...)" as appropriate, then update
related demos/tests to follow the new pattern.

---

Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor`:
- Around line 36-39: The fallback icon name embeds a rotation class
("ChevronRight bit-ico-r90") via BitIconInfo.From in BitDropMenu.razor which
couples styling to the name; instead, change to provide only the icon name via
ChevronDownIconName (or "ChevronRight") to BitIconInfo.From (used by
chevronIcon) and move the rotation class out to the <i> element by adding the
rotation CSS (e.g., bit-ico-r90) via Classes?.ChevronDown or a conditional class
alongside Styles?.ChevronDown; optionally use BitIconInfo.Css() to supply any
external icon CSS rather than embedding it in the name so GetCssClasses() only
reflects the logical icon name.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor`:
- Line 119: The demo currently injects external stylesheets inline (the <link>
tags) in BitDropMenuDemo.razor; update the demo to either move those stylesheet
includes into the app shell (e.g., index.html/_Host) for production or, if you
want to keep them in the demo page, add a short visible note or an HTML comment
next to the existing <link> tags in BitDropMenuDemo.razor explaining "For
production, load Font Awesome and Bootstrap Icons in the document <head> (e.g.,
index.html/_Host) instead of in-page links" so users are guided correctly;
reference the inline <link> elements in BitDropMenuDemo.razor when making this
change.

@msynk msynk merged commit 7f460fc into bitfoundation:develop Feb 18, 2026
3 checks passed
@msynk msynk deleted the 12105-blazorui-dropmenu-new-icons branch February 18, 2026 13:36
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 is missing in the BitDropMenu component

2 participants

Comments