Skip to content

MudToggleGroup: Refactor borders, Add border opacity support#11496

Merged
danielchalmers merged 1 commit intoMudBlazor:devfrom
danielchalmers:toggle-group-borders
Jun 14, 2025
Merged

MudToggleGroup: Refactor borders, Add border opacity support#11496
danielchalmers merged 1 commit intoMudBlazor:devfrom
danielchalmers:toggle-group-borders

Conversation

@danielchalmers
Copy link
Member

@danielchalmers danielchalmers commented Jun 14, 2025

Description

  • Adds CSS classes similar to existing Button ones and uses them to move the border styling to the stylesheet
  • Adds support for the new border opacity palette value which the buttons already had
  • Refactors delimiter styles to depend on parent being outlined which fixes delimiters appearing on hover

How Has This Been Tested?

visually

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

image

image

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@danielchalmers danielchalmers marked this pull request as ready for review June 14, 2025 19:43
@github-actions github-actions bot added the enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library label Jun 14, 2025
Copy link
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

This PR refactors the MudToggleGroup component’s border implementation by moving border styling into CSS, introduces palette-based border opacity support, and adjusts delimiter rendering for outlined groups.

  • Introduce .mud-toggle-group-outlined CSS class with dynamic palette color and opacity support
  • Refactor horizontal/vertical delimiter rules to only apply under outlined
  • Update Razor class builder to emit new CSS classes instead of inline border utilities

Reviewed Changes

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

File Description
src/MudBlazor/Styles/components/_togglegroup.scss Moved border styling from inline to .mud-toggle-group-outlined, added palette-based color variants and opacity handling, and scoped delimiters under the outlined class.
src/MudBlazor/Components/Toggle/MudToggleGroup.razor.cs Changed AddClass calls to emit mud-toggle-group-outlined and color-specific classes, removed old inline border and border-solid classes.
Comments suppressed due to low confidence (1)

src/MudBlazor/Components/Toggle/MudToggleGroup.razor.cs:83

  • New CSS classes for outlined and palette color variants have been introduced. It would be helpful to add or update unit tests to verify that mud-toggle-group-outlined and the corresponding color classes are correctly applied when the Outlined parameter is true.
.AddClass("mud-toggle-group-outlined", Outlined)

.mud-toggle-group-outlined {
border-width: 1px;
border-color: rgb(from var(--mud-palette-text-primary) r g b / var(--mud-palette-border-opacity));

Copy link

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

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

The .mud-toggle-group-outlined rule defines border-width and border-color but omits border-style. Without border-style: solid, the border will not render. Please add border-style: solid; under this selector.

Suggested change
border-style: solid;

Copilot uses AI. Check for mistakes.
.AddClass($"mud-toggle-group-size-{Size.ToDescriptionString()}")
.AddClass("mud-toggle-group-rtl", RightToLeft)
.AddClass($"border mud-border-{Color.ToDescriptionString()} border-solid", Outlined)
.AddClass($"mud-toggle-group-{Color.ToDescriptionString()}")
Copy link

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

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

[nitpick] The color variant class (mud-toggle-group-{color}) is applied unconditionally. It only affects outlined groups, so consider adding it under the same Outlined predicate to avoid emitting unused classes on non-outlined components.

Suggested change
.AddClass($"mud-toggle-group-{Color.ToDescriptionString()}")
.AddClass($"mud-toggle-group-{Color.ToDescriptionString()}", Outlined)

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jun 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.15%. Comparing base (5df9ab1) to head (c572f89).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #11496   +/-   ##
=======================================
  Coverage   91.14%   91.15%           
=======================================
  Files         466      466           
  Lines       14497    14498    +1     
  Branches     2816     2816           
=======================================
+ Hits        13214    13215    +1     
  Misses        644      644           
  Partials      639      639           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mckaragoz
Copy link
Member

Did you check with the vertical? Lgtm, we need this fix

@sonarqubecloud
Copy link

@danielchalmers
Copy link
Member Author

Did you check with the vertical? Lgtm, we need this fix

Don't see any issues with CheckMark, FixedContent, Vertical

@danielchalmers danielchalmers merged commit da92af3 into MudBlazor:dev Jun 14, 2025
7 checks passed
@danielchalmers danielchalmers deleted the toggle-group-borders branch June 14, 2025 19:56
@danielchalmers danielchalmers removed the request for review from ScarletKuro June 14, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants