Support for an element extension mechanism #5600
Labels
affected-few
This issue impacts only small number of customers
area-blazor
Includes: Blazor, Razor Components
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
feature-blazor-component-model
Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc)
severity-major
This label is used by an internal tool
Milestone
One use-case for having an extension mechanism on existing elements is already given here: https://github.com/aspnet/Blazor/issues/404#issuecomment-413037767, which can be used for form validation and the like. I didn't get any response on that so I will provide a little more extensive description this time to see if there is some interest. This time will be about providing a typed manner for Bootstrap concepts.
Let say we want to write:
instead of:
and this:
instead of:
and get those extended attributes, Type, Expand, Color, etc. in a typed manner!
To describe how that can be accomplished I am getting into muddy waters… so take it with a grain of salt… but I am imagining a way to specify those extensions similar to this
Now we get into even muddier waters to talk about hooks into the render-builder… but see it as something to spur your thinking. I think it will be easiest to have a combination of run-time-calls and design-time-services, like having the calls
which are present in the cases when a design-time service returns them
But I am open to any suggestions. In addition, I expect there will be a need to resolve parameters at design-time also, thus the conversion attributes and in this case from string literals to replace their typed counterpart in the generated c# file.
Parameter tags:
Somewhat semi-related is that I think it would make sense to allow these extended attributes to be set as tags also. Especially when it comes to multi-value settings of columns in a grid, etc., but I haven’t explored that. It relates somewhat also to this comment Add Support for Templated Components blazor#1404 (comment).
Parameter tag constructs:
Having same construct of tags referring to a mix of types and parameters can get it even more convoluted then. Do you think it will make sense do introduce an attribute at module level to configure it, so that one can try different styles before it is settled?
@SteveSandersonMS I mentioned point 2 and 3 here just so you can reflect on it with respect to this idea also.
I think this mechanism would be very powerful, although I must admit I am new to both Blazor and Bootstrap. I have a third use-case that could use this extension mechanism for another time.
Is this of any interest? Any thoughts?
The text was updated successfully, but these errors were encountered: