Blazor App forms

Forms can be created using the Form component. It can be a mix of various types of input components that bind to a PowerShell class type.

Basic Form

A basic form requires a PowerShell class definition to define the object used as the model for the form. Below is an example of the script behind this Blazor app. It creates a PowerShell class, sets it to the $Model variable and then defines an event callback to invoke when the form is submitted.

class MyClass {

$Variables["Model"] = [MyClass]::new()

function Submit {


To use the above PowerShell script in a form, you can use the following PSBlazor syntax.

    <Form Model="$Model" OnFinish="Submit">
            <Input bind-Value="$Model.Str" />
            <Button HtmlType="Submit">Submit</Button>

Last updated

Copyright 2022 Ironman Software