ワンクリックで
render-info
Using the RendererInfo class in Blazor to detect rendering context and interactivity.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Using the RendererInfo class in Blazor to detect rendering context and interactivity.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | render-info |
| description | Using the RendererInfo class in Blazor to detect rendering context and interactivity. |
The RendererInfo class in Blazor provides runtime information about the renderer that is executing the component. It is particularly useful for detecting whether a component is running interactively or statically, and for identifying the specific rendering platform (e.g., Server, WebAssembly, WebView).
IsInteractivebool@if (!RendererInfo.IsInteractive)
{
<p>Connecting...</p>
}
else
{
<button @onclick="HandleClick">Click Me</button>
}
Namestring"Static": Running in static server-side rendering (SSR)."Server": Running in Interactive Server mode (SignalR)."WebAssembly": Running in Interactive WebAssembly mode."WebView": Running in a Blazor Hybrid application (MAUI, WPF, WinForms).<p>Current Render Mode: @RendererInfo.Name</p>
When a component is prerendered on the server, event handlers (like @onclick) are not active. You can use RendererInfo.IsInteractive to disable inputs until the interactive runtime takes over.
<button @onclick="Submit" disabled="@(!RendererInfo.IsInteractive)">
Submit
</button>
You might want to show a simple HTML form for static SSR and a rich, interactive component for interactive modes.
@if (RendererInfo.Name == "Static")
{
<form action="/search" method="get">
<input name="q" />
<button type="submit">Search</button>
</form>
}
else
{
<SearchComponent />
}
AssignedRenderMode: A property on ComponentBase that tells you which render mode was assigned to the component (e.g., InteractiveServer, InteractiveWebAssembly, InteractiveAuto). Note that AssignedRenderMode might be null during static rendering.RendererInfo is available in .NET 8.0 and later.