dotnet / dotnet/aspnetcore

Add extensibility point for EditContext FieldCSSClass for Blazor forms - The current options are too limited

Open
#17,996 3 comments 2 reactions 0 assignees View on GitHub
affected-few area-blazor enhancement feature-blazor-builtin-components severity-blocking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is your feature request related to a problem? Please describe.
The current implementation of FieldCSSClass as a baked in extension method is limited to only some combination of "modified", "valid", or "invalid". With something as important as form editing context, we need to be able to extend this with other options such as warning, busy, readonly, disabled, hidden etc... Don't limit this to a predefined set, let the developer customize as needed

### Describe the solution you'd like
Simply add the ability to override the default behavior. A simple option would be to allow an action to be assigned to the editcontext. If its assigned, then allow that action to determine the cssclass for the field. A better option would be to change the current implementation into something more modular by adding adding an interface like IFieldCSSClassProvider and then allowing a custom provider to be plugged in.

### Additional context
Most css frameworks already support other options - especially warning, so it would make sense to allow this extensibility point for developers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.