Dynamic component for Blazor apps.

The dynamic component allows you to run PowerShell script to generate PSBlazor components on the fly. It's context aware.

Because dynamic components run PowerShell with each render, they can reduce the performance of your apps.

A dynamic component is defined with a function that will be executed when the app is loaded.

<Dynamic Function="RenderMyDynamic" />

Within the dynamic, return a string that will be rendered. It must be valid PSBlazor syntax.

function RenderMyDynamic {
    "<Alert Message='Cool!' />"

If you are using a dynamic within a component that sets a context variable, you can use the context in your function. In this example, we have a table of services that uses a dynamic in the status column.

<Table DataSource="$Services">
    <PropertyColumn Property="Name" />
    <PropertyColumn Property="Status">
        <Dynamic Function="RenderStatusColumn" />

The function RenderStatusColumn will be called for each row in the table.

function RenderStatusColumn {
    if ($Context.Status -eq 'Running')
        "<Alert Message='Started' />"
        "<Alert Message='$($Context.Status)' />"

Last updated

Copyright 2022 Ironman Software