@using Microsoft.AspNetCore.Blazor.RenderTree

Markup blocks

This component contains blocks of static HTML markup that will be represented in the render instructions as single frames. This includes nested elements with attributes.

Dynamic markup

It's also possible to emit markup blocks from render fragments:

[@((RenderFragment)EmitMarkupBlock)]

Markup string

It's also possible to declare a value of a special type that renders as markup:

@((MarkupString)myMarkup) @functions { bool changeOutput; string myMarkup = "

This is a markup string.

"; void EmitMarkupBlock(RenderTreeBuilder builder) { // To show we detect and apply changes to markup blocks if (!changeOutput) { builder.AddMarkupContent(0, "Here is an example. We support multiple-top-level nodes."); } else { builder.AddMarkupContent(0, "The output was changed completely."); } } }