Skip to content

Tag Helper Renderers

Jamie Pollock edited this page Jan 11, 2024 · 3 revisions

Tag Helper Renderers are a way for developers to modify how tag helpers are rendered. A default tag helper renderer will always be provided by Rhythm Drop but in certain cases a developer may need to modify how things are rendered which are beyond the scope of what this library has to offer.

Adding your own

Each tag helper renderer can be overridden at startup within the AddRhythmDrop builder call.

builder.AddRhythmDrop((dropBuilder) => {
  dropBuilder.SetDropImageTagHelperRenderer<MyCustomDropImageTagHelperRenderer>();
});

A tag helper will have a method that looks a bit like this:

Task RenderAsync(TModel? model, TagHelperContext context, TagHelperOutput output);

Where TModel? is the modified context provided to the code. This should contain all the information needed to modify the TagHelperOutput. The TagHelperContext is also present in case this contains information set by other logic or tag helpers which could be used by this code.

Clone this wiki locally