The package contains server side Blazor forms extensions used by other CodeGator packages.
- Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions
- CG.Blazor.Forms.Components.DynamicForm
- CG.Blazor.Forms.Attributes.FormGeneratorAttribute
- CG.Blazor.Forms.Attributes.FormValidationAttribute
- CG.Blazor.Forms.Attributes.RenderObjectAttribute
- CG.Blazor.Forms.Attributes.Validation.RenderDataAnnotationsValidatorAttribute
- CG.Blazor.Forms.Attributes.Validation.RenderValidationSummaryAttribute
- CG.Blazor.Forms.Attributes.Html.HtmlAttribute
- CG.Blazor.Forms.Attributes.Html.RenderCheckBoxAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputColorAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputDateAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputEmailAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputMonthAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputNumberAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputPasswordAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputRangeAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputSelectAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputTelephoneAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputTextAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputTimeAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputUrlAttribute
- CG.Blazor.Forms.Attributes.Html.RenderInputWeekAttribute
- CG.Blazor.Forms.Attributes.Html.RenderMeterAttribute
- CG.Blazor.Forms.Attributes.Html.RenderProgressAttribute
- CG.Blazor.Forms.Attributes.Html.RenderRadioGroupAttribute
- CG.Blazor.Forms.Attributes.Html.RenderTextAreaAttribute
- .NET 6.x or higher
The binary is hosted on NuGet. To install the package using the NuGet package manager:
PM> Install-Package CG.Blazor.Forms
If you've spotted a bug in the code please use the project Issues HERE
We have a discussion group HERE
There is developer documentation HERE
We also blog about projects like this one on our website, HERE
There is a working quick start sample HERE
Steps to get started:
-
Create a Blazor project to get started.
-
Add the CG.Blazor.Forms NUGET package to the project.
-
Add
@using CG.Blazor.Forms.Attributes
to the _Imports.razor file. -
Add
<DynamicForm Model="@Model" OnValidSubmit="OnValidSubmit"/>
to the razor component where you want your dynamic form generated. Note thatModel
is a reference to your POCO object, andOnValidSubmit
is a reference to your form's submit handler. -
Add
services.AddFormGeneration();
to theConfigureServices
method of theStartup
class. -
Create your model type. Use attributes from the NUGET package to decorate any properties you want to be rendered on the form. Here is an example:
[RenderValidationSummary()]
[RenderFluentValidationValidator]
public class MyForm
{
[RenderInputText]
[Required]
public string FirstName { get; set; }
[RenderInputText]
[Required]
public string LastName { get; set; }
}
This package and it's contents are experimental in nature. There is no official support. Use at your own risk.