UI for Blazor
Creating all sorts of forms is easy with the Telerik UI for Blazor Form component. As with other Blazor components, it gives you creative freedom in how you want to build your next application’s registration page or contact form while also keeping it simple – it can even be autogenerated from your data model!
Check out the Blazor Form demo
As mentioned, data can be bound to the Form component which will autogenerate all fields according your model, with different input elements used for different properties in the model (e.g. numbers will use a <NumericTextBox>.) This will both make sure set you the values of your model directly with what the user entered but also save you time. When the form is provided with a data model, it will automatically generate an input field for every property in your model, depending on its type!
Leverage the AutoGenerated feature in the Telerik UI for Blazor Form component to automatically generate fields based on the field type it finds in the model. Benefit from the AutoGeneratedFormItems parameter to use both autogenerated form items along with manually declared ones. This will enable you to cover any use case scenario, e.g., when most of the fields should be autogenerated but a few of them would require customization or vice versa.
The Form can be validated in its entirety through the built-in Blazor validation. This means you can provide validation rules directly on your model using attributes like Required, Range or MaxLength but any field the form contains can also be validated on its own. If you take this approach you wouldn’t even have to write any special logic.More than that, Telerik UI for Blazor also provides 3 separate components to display validation errors. Read more about the ValidationSummary, ValidationMessage & ValidationTooltip.
The Form can be fit anywhere on the page because it can be oriented both horizontally and vertically. It can render separate columns if you want it to. Configure it so it makes the most sense in your use case!
The Blazor Form UI component has an EditorType parameter that provides a simple way to change the default field editors based on the supplied data type. You have the flexibility to choose between a DatePicker, DateTimePicker or TimePicker for the DateTime type, and a TextBox or TextArea for the string fields.
See example of custom editors in Blazor Form component.
If you don’t want to autogenerate the form from your data model, you can add a list of <FormItem>s. They can be customized in several ways like changing their appearance, data binding model values, adding hints and so on.
The Form supports four events: OnSubmit, OnValidSubmit, OnInvalidSubmit and OnUpdate
Use the Form component Id property to reference the component where necessary, for example to mark a button to serve as the “Submit” button for that form.
The Telerik Blazor Form component has several built-in themes such as Default (our own styling), Material (based on the Material Design guidelines), Bootstrap (which looks like the Bootstrap styling to integrate better) and Fluent (based on Microsoft Fluent UI). You can easily customize any of out-of-the-box themes, style a specific component instance or create new theme to match your colors and branding by using the Telerik SASS ThemeBuilder application.
The Telerik UI for Blazor Form component supports right-to-left configuration. The RTL functionality is supported by most of our components to accommodate users who communicate in a right-to-left language script, such as Arabic and Hebrew.