diff --git a/aspnetcore/blazor/components/index.md b/aspnetcore/blazor/components/index.md index 8de35bf1981c..391b702e40d2 100644 --- a/aspnetcore/blazor/components/index.md +++ b/aspnetcore/blazor/components/index.md @@ -1274,7 +1274,7 @@ For information on setting an app's base path, see ` tag: +Since Blazor renders HTML, browser-supported images, including [Scalable Vector Graphics (SVG) images (`.svg`)](https://developer.mozilla.org/docs/Web/SVG), are supported via the `` tag: ```html Example image @@ -1288,7 +1288,49 @@ Similarly, SVG images are supported in the CSS rules of a stylesheet file (`.css } ``` -However, inline SVG markup isn't supported in all scenarios. If you place an `` tag directly into a Razor file (`.razor`), basic image rendering is supported but many advanced scenarios aren't yet supported. For example, `` tags aren't currently respected, and [`@bind`][10] can't be used with some SVG tags. For more information, see [SVG support in Blazor (dotnet/aspnetcore #18271)](https://github.com/dotnet/aspnetcore/issues/18271). +::: moniker range=">= aspnetcore-6.0" + +Blazor supports the [``](https://developer.mozilla.org/docs/Web/SVG/Element/foreignObject) element to display arbitrary HTML within an SVG. The markup can represent arbitrary HTML, a , or a Razor component. + +The following example demonstrates: + +* Display of a `string` (`@message`). +* Two-way binding with an `` element and a `value` field. +* A `Robot` component. + +```razor + + + +

@message

+
+
+ + + + + + + + + + + + + +@code { + private string message = "Lorem ipsum dolor sit amet, consectetur adipiscing " + + "elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; + + private string value; +} +``` + +::: moniker-end ## Whitespace rendering behavior