Skip to content

Commit 63c23d1

Browse files
authored
Add RendererInfo examples
1 parent 38acaae commit 63c23d1

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

aspnetcore/blazor/components/render-modes.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,28 @@ The <xref:Microsoft.AspNetCore.Components.ComponentBase.RendererInfo?displayProp
226226
* `InteractiveAuto` for Interactive Auto.
227227
* `InteractiveWebAssembly` for Interactive WebAssembly.
228228

229-
Components use these properties to render content depending on their location or interactivity status. For example, a form can be disabled during prerendering and enabled when the component becomes interactive:
229+
Components use these properties to render content depending on their location or interactivity status. The following examples demonstrate typical use cases.
230+
231+
Display content and disable a button until a component is interactive:
232+
233+
```razor
234+
@if (!RendererInfo.IsInteractive)
235+
{
236+
<p>Connecting to the assistant...</p>
237+
}
238+
else
239+
{
240+
// Code to display chatbot messages
241+
}
242+
243+
...
244+
245+
<button ... disabled="@(chatState is null || !RendererInfo.IsInteractive)">
246+
Send
247+
</button>
248+
```
249+
250+
A form can be disabled during prerendering and enabled when the component becomes interactive:
230251

231252
```razor
232253
<EditForm Model="Movie" ...>
@@ -256,7 +277,7 @@ Components use these properties to render content depending on their location or
256277
}
257278
```
258279

259-
The next example shows how to render markup to support performing a regular HTML action if the component is statically rendered:
280+
Render markup to support performing a regular HTML action if the component is statically rendered:
260281

261282
```razor
262283
@if (AssignedRenderMode is null)

0 commit comments

Comments
 (0)