Skip to content

Add new Icon parameter to BitAccordion (#12232)#12233

Merged
msynk merged 6 commits intobitfoundation:developfrom
msynk:12232-blazorui-accordion-new-icons
Mar 30, 2026
Merged

Add new Icon parameter to BitAccordion (#12232)#12233
msynk merged 6 commits intobitfoundation:developfrom
msynk:12232-blazorui-accordion-new-icons

Conversation

@msynk
Copy link
Copy Markdown
Member

@msynk msynk commented Mar 30, 2026

closes #12232

Summary by CodeRabbit

  • New Features
    • Accordion supports customizable expander icons via two new parameters (icon name or detailed icon object) for greater visual flexibility.
  • Documentation / Demo
    • Demo pages updated with examples for built-in and external icon sets and an "ExpanderIcon" showcase.
  • Style
    • Added rotation utility classes and adjusted accordion icon styles for proper wrapping and rotation.
  • Tests
    • Updated tests to assert expander icon wrapper and rotation behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8e87a950-4ca0-4b97-aaad-2918323dd2c8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

BitAccordion gained customizable expander icon support via new parameters (ExpanderIcon, ExpanderIconName), updated rendering markup to resolve icons through BitIconInfo, renamed/added styling hooks and CSS classes, demo pages updated with examples, and tests adjusted to the new DOM structure.

Changes

Cohort / File(s) Summary
Accordion component API
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor.cs
Added [Parameter] public BitIconInfo? ExpanderIcon { get; set; } and [Parameter] public string? ExpanderIconName { get; set; } (ExpanderIcon takes precedence; ChevronRight fallback).
Accordion rendering
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor
Replaced single <i> with <span> wrapper + nested <i>; icon resolved via BitIconInfo.From(ExpanderIcon, ExpanderIconName ?? "ChevronRight ..."); wrapper and icon bind to new class/style properties and rotation class when expanded.
Accordion styling & class hooks
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.scss, src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordionClassStyles.cs
Renamed/added CSS/class-style properties: removed ChevronDownIcon; added ExpanderIconWrapper, ExpanderIcon, ExpandedIcon; introduced .bit-acd-eiw and .bit-acd-eic selectors; removed old rotation selector.
Global icon rotations
src/BlazorUI/Bit.BlazorUI/Styles/general.scss
Added negative-rotation utility classes .bit-ico--r90 and .bit-ico--r180 (transform: rotate(-90deg/-180deg)).
Demo updates
src/BlazorUI/Demo/.../BitAccordionDemo.razor, .../BitAccordionDemo.razor.cs
Replaced RTL demo slot with ExpanderIcon examples demonstrating ExpanderIconName and ExpanderIcon usage, added External icons examples (FontAwesome/Bootstrap Icons), and updated demo metadata and class-style entries.
Demo styling
src/BlazorUI/Demo/.../DemoExample.razor.scss
Removed a responsive padding declaration and BOM from an import line.
Tests
src/BlazorUI/Tests/.../BitAccordionTests.cs
Updated DOM selectors and assertions to target the new icon wrapper class (.bit-acd-eiw) and rotation class (bit-ico--r180) instead of the previous direct <i> and bit-acd-hex.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰
A ribbon of icons now hops out to play,
ExpanderIcon chooses its own bright way.
I twirl chevrons, spin fonts with delight,
The accordion smiles and opens just right. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Out of Scope Changes check ❓ Inconclusive Changes are focused on icon parameter implementation; however, CSS class renames and demo refactoring appear tangential to the core objective. Clarify whether CSS class refactoring (e.g., .bit-acd-hic to .bit-acd-eiw) and demo restructuring are essential to the Icon parameter feature or represent separate enhancements.
✅ Passed checks (3 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 a new Icon parameter to BitAccordion, which aligns with the PR's core objective.
Linked Issues check ✅ Passed The PR implements the Icon parameter for BitAccordion via ExpanderIcon and ExpanderIconName parameters to support external icon implementations, meeting issue #12232's requirements.

✏️ 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds configurable expander icon support to BitAccordion so consumers can use either Fluent UI icon names or external icon libraries via BitIconInfo.

Changes:

  • Added ExpanderIcon (BitIconInfo?) and ExpanderIconName (string?) parameters and updated rendering to use BitIconInfo.From(...) with a ChevronRight default.
  • Renamed the expander icon styling hook from ChevronDownIcon to ExpanderIcon (including the related CSS selector rename).
  • Updated the Accordion demo to document and showcase the new parameters.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor.cs Introduces the new expander icon parameters on the component API.
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor Uses BitIconInfo to render the expander icon with fallback behavior.
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordionClassStyles.cs Renames the public class/styles hook for the expander icon.
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.scss Renames the internal expander icon CSS class selector.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor Adds a new demo example for ExpanderIcon*.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor.cs Updates demo metadata/docs and adds the sample snippet string.

Comment thread src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.scss Outdated
Comment thread src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor Outdated
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor.cs (1)

62-75: LGTM with a minor observation.

The parameter metadata is comprehensive and correctly documents the precedence and default behavior.

One small inconsistency: Line 74 refers to "built-in Fluent UI icons" while BitIconInfo.cs documents these as "bit BlazorUI icons". Consider aligning terminology for consistency.

📝 Optional terminology alignment
         new()
         {
             Name = "ExpanderIconName",
             Type = "string?",
             DefaultValue = "null",
-            Description = "Gets or sets the name of the icon to display as expander from the built-in Fluent UI icons. Defaults to ChevronRight if not set."
+            Description = "Gets or sets the name of the icon to display as expander from the built-in bit BlazorUI icons. Defaults to ChevronRight if not set."
         },
🤖 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/Surfaces/Accordion/BitAccordionDemo.razor.cs`
around lines 62 - 75, Update the Description text for the ExpanderIconName
parameter in BitAccordionDemo.razor.cs so terminology matches the rest of the
project (use the same term used in BitIconInfo.cs, e.g., "Bit BlazorUI icons"
instead of "built-in Fluent UI icons"); locate the ExpanderIcon and
ExpanderIconName entries and change only the descriptive string for
ExpanderIconName to the consistent phrase while keeping the precedence and
default behavior wording intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor.cs`:
- Around line 62-75: Update the Description text for the ExpanderIconName
parameter in BitAccordionDemo.razor.cs so terminology matches the rest of the
project (use the same term used in BitIconInfo.cs, e.g., "Bit BlazorUI icons"
instead of "built-in Fluent UI icons"); locate the ExpanderIcon and
ExpanderIconName entries and change only the descriptive string for
ExpanderIconName to the consistent phrase while keeping the precedence and
default behavior wording intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 35ade3ee-d7c3-4473-9242-22d6d214a2c5

📥 Commits

Reviewing files that changed from the base of the PR and between f975321 and 5c33c97.

📒 Files selected for processing (6)
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.scss
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordionClassStyles.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor.cs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor Outdated
@msynk
Copy link
Copy Markdown
Member Author

msynk commented Mar 30, 2026

@coderabbitai re-review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

@msynk Sure, I'll re-review the changes in this PR right away!

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown

@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: 4

🧹 Nitpick comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor (1)

244-245: Load external icon styles once at app/page head instead of inside demo body.

Injecting CDN <link> tags directly in example body can lead to duplicate loads/reflows when the demo rerenders. Prefer central head-level inclusion for these assets.

Also applies to: 272-273

🤖 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/Surfaces/Accordion/BitAccordionDemo.razor`
around lines 244 - 245, The demo page BitAccordionDemo.razor currently injects
an external Font Awesome <link> tag in its markup (the CDN link at lines shown
in the diff); remove that <link> tag(s) from the BitAccordionDemo.razor demo
body (and any other demos that repeat it, e.g., the instances around 272-273)
and instead include the stylesheet once at the application shell/head (for
Blazor WASM use index.html, for Blazor Server use _Host.cshtml or the shared
layout like MainLayout) so the icon CSS is loaded centrally and not re-inserted
on component rerenders.
🤖 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/Surfaces/Accordion/BitAccordion.razor`:
- Line 40: In BitAccordion.razor fix the missing space between class tokens so
the expanded icon class is properly applied: update the class attribute where
expanderIcon?.GetCssClasses(), the literal "bit-acd-eic" and the conditional
(IsExpanded ? Classes?.ExpandedIcon : "") are concatenated to ensure a delimiter
(space) is inserted before Classes?.ExpandedIcon when IsExpanded is true (while
preserving existing Classes?.ExpanderIcon), e.g., add a leading space before the
expanded class in the interpolation so IsExpanded yields " bit-acd-eic
<expanded-class>" instead of merging names.

In `@src/BlazorUI/Bit.BlazorUI/Styles/general.scss`:
- Line 1: The SCSS import in general.scss uses a file extension which violates
the scss/load-partial-extension rule; update the import in general.scss to omit
the “.scss” extension (e.g., change the `@import` "functions.scss" statement to
`@import` "functions") so the partial (_functions.scss) is imported without its
extension and the stylelint rule is satisfied.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/DemoExample.razor.scss`:
- Around line 1-3: In DemoExample.razor.scss replace the three `@import`
references that include leading underscores and “.scss” (the imports for
_functions.scss, _media-queries.scss, and _bit-css-variables.scss) with imports
that omit the partial leading underscore and the .scss extension (i.e., import
the partial names functions, media-queries, and bit-css-variables instead) so
they comply with the Stylelint rules scss/load-no-partial-leading-underscore and
scss/load-partial-extension.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor.cs`:
- Line 216: The demo uses a misspelled sub-parameter name "ExpanderIconWapper";
update the Name assignment in BitAccordionDemo (where Name =
"ExpanderIconWapper") to the correct public API name "ExpanderIconWrapper" so
the demo matches the component's property (ExpanderIconWrapper) and the docs
remain consistent.

---

Nitpick comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor`:
- Around line 244-245: The demo page BitAccordionDemo.razor currently injects an
external Font Awesome <link> tag in its markup (the CDN link at lines shown in
the diff); remove that <link> tag(s) from the BitAccordionDemo.razor demo body
(and any other demos that repeat it, e.g., the instances around 272-273) and
instead include the stylesheet once at the application shell/head (for Blazor
WASM use index.html, for Blazor Server use _Host.cshtml or the shared layout
like MainLayout) so the icon CSS is loaded centrally and not re-inserted on
component rerenders.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 10e80735-9d11-4a7b-a0db-d445df73cdd3

📥 Commits

Reviewing files that changed from the base of the PR and between f975321 and d4fdd4d.

📒 Files selected for processing (9)
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.scss
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordionClassStyles.cs
  • src/BlazorUI/Bit.BlazorUI/Styles/general.scss
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/DemoExample.razor.scss
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Accordion/BitAccordionDemo.razor.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Surfaces/Accordion/BitAccordionTests.cs

Comment thread src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Accordion/BitAccordion.razor Outdated
Comment thread src/BlazorUI/Bit.BlazorUI/Styles/general.scss
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@msynk msynk merged commit 6843e7f into bitfoundation:develop Mar 30, 2026
7 checks passed
@msynk msynk deleted the 12232-blazorui-accordion-new-icons branch March 30, 2026 21:15
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.

New Icon implementation for the BitAccordion component

3 participants