havit / Havit.Blazor

Free Bootstrap 5 components for ASP.NET Blazor + optional enterprise-level stack for Blazor development (gRPC code-first, layered architecture, localization, auth, ...)
https://havit.blazor.eu
MIT License
517 stars 69 forks source link

[CONCEPT] Allow combining CSS-classes within component customization - `CoreCssClass` #204

Open hakenr opened 2 years ago

hakenr commented 2 years ago

Problem description

Currently, when you set

HxSomething.Defaults.XyCssClass = "default-class";

and then set the class in markup code

<HxSomething XyCssClass="local-class" />

the default-class is lost and overridden by local-class assignment.

For better customizability (especially application-wide settings) we should be able to combine CSS classes from settings with instance CSS classes (local markup etc.) to get both classes rendered default-class local-class.

Solution proposal

Some component libraries support this through additional syntax in CssClass-properties, such as +default-class, but this is probably not the way we would like to go.

Some of our component already use CoreCssClass properties/methods which behave this way (they get added to the CssClass in the end).

I think we should consolidate the current definitions and usages of [Xy]CoreCssClass and add the ability to set them through Settings and Defaults. This should solve the issue we are facing...

@crdo @jirikanda What do you think?

crdo commented 2 years ago

I am up for the proposed solution.