feat(blazor): add CssClass parameter to ValidationSummary component#66531
Open
EduardF1 wants to merge 4 commits intodotnet:mainfrom
Open
feat(blazor): add CssClass parameter to ValidationSummary component#66531EduardF1 wants to merge 4 commits intodotnet:mainfrom
EduardF1 wants to merge 4 commits intodotnet:mainfrom
Conversation
Adds a CssClass parameter to ValidationSummary so users can supply additional CSS classes that get appended to the default validation-errors class. Fixes dotnet#43860
Contributor
|
Thanks for your PR, @EduardF1. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Author
|
@dotnet-policy-service agree |
Open
3 tasks
842ad84 to
88f0525
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #43860
Adds a
CssClassparameter to theValidationSummaryBlazor component so users can pass custom CSS classes that get appended to the defaultvalidation-errorsclass.Before:
After:
Implementation
Implements the approach suggested by @SteveSandersonMS in the issue comments. Adds a
CssClassparameter following the same pattern used byInputBase<T>and other Blazor form components:AttributeUtilities.CombineClassNamesmergesAdditionalAttributes["class"](if any), the basevalidation-errorsclass, and the newCssClassparameterAddMultipleAttributesfires first, thenAddAttributeforclassso the computed combined class correctly overrides anyclasskey that might exist inAdditionalAttributesChanges
src/Components/Web/src/Forms/ValidationSummary.cs— addsCssClassparameter and updatesBuildRenderTreesrc/Components/Web/src/PublicAPI.Unshipped.txt— new public API entriessrc/Components/test/testassets/BasicTestApp/FormsTest/TypicalValidationComponent.razor— adds a second<ValidationSummary CssClass="custom-summary-css-class" />for E2E coveragesrc/Components/test/E2ETest/Tests/FormsTest.cs— addsValidationSummaryAppliesCssClassE2E test