A powerful, type-safe dynamic form library for Blazor applications with fluent API design. Build complex forms with ease using a fluent interface, dynamic validation, field dependencies, and extensible rendering. Try the interactive demo at https://phmatray.github.io/FormCraft/
$ dotnet add package FormCraftA powerful, type-safe dynamic form library for Blazor applications with fluent API design.
🌐 Live Demo | 📚 Documentation
dotnet add package FormCraft
Program.cs:builder.Services.AddFormCraft();
var configuration = FormBuilder<MyModel>.Create()
.AddRequiredTextField(x => x.Name, "Full Name")
.AddEmailField(x => x.Email)
.AddNumericField(x => x.Age, "Age", min: 18, max: 100)
.Build();
You can also configure fields using attributes on your model:
public class MyModel
{
[Required]
[TextField("Full Name", "Enter your name")]
public string Name { get; set; } = string.Empty;
}
var configuration = FormBuilder<MyModel>.Create()
.AddFieldsFromAttributes()
.Build();
<FormCraftComponent TModel="MyModel"
Model="@myModel"
Configuration="@configuration"
OnValidSubmit="@HandleSubmit"
ShowSubmitButton="true" />
For detailed documentation and examples, visit our interactive documentation site.
This project is licensed under the MIT License.