In Blazor, you can render raw HTML from a component using the MarkupString type. The MarkupString type allows you to render HTML content directly without being sanitized or escaped by the framework.
Here’s how you can use MarkupString to render raw HTML in a Blazor component:
@((MarkupString)RawString)
@code {
public string RawString = "<span style='color:red'>Blazor is awesome</span>";
}
Share with