Use this file to discover all available pages before exploring further.
Custom properties allow you to extend forms and fields with additional metadata beyond the standard UIMF properties. This is useful for adding client-specific configuration, styling hints, or any other metadata your application needs.
using UiMetadataFramework.Core.Binding;public class MyRequest{ [InputField(Label = "Username")] [StringProperty("placeholder", "Enter your username")] [StringProperty("css-class", "primary-input")] public string? Username { get; set; }}
using UiMetadataFramework.Core.Binding;public class MyRequest{ [InputField(Label = "Age")] [IntProperty("min-value", 18)] [IntProperty("max-value", 100)] public int? Age { get; set; }}
For complex custom properties, create your own attribute by inheriting from CustomPropertyAttribute:
using System;using UiMetadataFramework.Core.Binding;public class TooltipAttribute : CustomPropertyAttribute{ public TooltipAttribute(string text) : base("tooltip") { this.Text = text; } public string Text { get; set; } public override object GetValue(Type type, MetadataBinder binder) { return new { text = this.Text, position = "top" }; }}
Usage:
public class MyRequest{ [InputField(Label = "Password")] [Tooltip("Must be at least 8 characters long")] public Password? Password { get; set; }}
Some custom properties contain arrays of values. Mark them with [CustomPropertyConfig(IsArray = true)]:
using System;using System.Collections.Generic;using UiMetadataFramework.Core.Binding;[CustomPropertyConfig(IsArray = true)]public class DocumentationAttribute : CustomPropertyAttribute{ public DocumentationAttribute(string text) : base("documentation") { this.Text = text; } public string Text { get; set; } public override object GetValue(Type type, MetadataBinder binder) { return this.Text; }}
Usage - multiple instances are collected into an array:
public class MyRequest{ [InputField(Label = "Email")] [Documentation("Must be a valid email address")] [Documentation("We will send a confirmation email")] public string? Email { get; set; }}
The metadata will contain:
{ "documentation": [ "Must be a valid email address", "We will send a confirmation email" ]}
using UiMetadataFramework.Core.Binding;public class ValidationFormRequest{ [InputField(Label = "Email", Required = true)] [StringProperty("pattern", @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$")] [StringProperty("error-message", "Please enter a valid email address")] public string? Email { get; set; } [InputField(Label = "Age")] [IntProperty("min", 18)] [IntProperty("max", 120)] [StringProperty("error-message", "Age must be between 18 and 120")] public int? Age { get; set; }}
using System;using UiMetadataFramework.Core.Binding;public class FieldHelpAttribute : CustomPropertyAttribute{ public FieldHelpAttribute(string title, string content) : base("help") { this.Title = title; this.Content = content; } public string Title { get; set; } public string Content { get; set; } public string? Link { get; set; } public override object GetValue(Type type, MetadataBinder binder) { return new { title = this.Title, content = this.Content, link = this.Link }; }}public class MyRequest{ [InputField(Label = "API Key")] [FieldHelp( "API Key", "You can find your API key in your account settings", Link = "https://example.com/docs/api-keys" )] public string? ApiKey { get; set; }}