C
Join ServerC#
help
❔ Abstracting html in Razor
AAntonC11/21/2022
I want to define custom components to abstract away some html content. These should be able to accept props, like key names, expressions, or pieces of html. For example:
should be produced from e.g.
or something like that. Should I make a bunch of tag helpers? I know that these can't be backed by html files. Partial views maybe?
I've read that razor components is something else, it's tightly coupled with blazor
<div class="a-bunch-of-tailwind-classes">
<label class="a-bunch-of-classes" asp-for="Expression"/> DisplayName
<input class="a bunch of classes" asp-for="Expression" some-validation-stuff type="Type"/>
</div>
should be produced from e.g.
<LabeledInput Expression="Model.Title" DisplayName="Title" Type="text"/>
or something like that. Should I make a bunch of tag helpers? I know that these can't be backed by html files. Partial views maybe?
I've read that razor components is something else, it's tightly coupled with blazor
AAntonC11/21/2022
Passing down
ModelExpression
s to partial views or tag helpers results in a massive jump in complexityAAntonC11/21/2022
AAccord11/22/2022
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.