All input components are defined in the UiMetadataFramework.Basic.Inputs namespace. Each component has a corresponding C# type that you use in your form request classes.
using UiMetadataFramework.Basic.Inputs.Textarea;public class MyFormRequest{ [InputField(Label = "Description")] public TextareaValue Description { get; set; }}
using UiMetadataFramework.Basic.Inputs.Dropdown;public class MyFormRequest{ [InputField(Label = "Status")] [Dropdown(typeof(StatusSource))] public DropdownValue<string> Status { get; set; }}
public interface IDropdownInlineSource{ IEnumerable<DropdownItem> GetItems();}
Usage Example:
public class StatusSource : IDropdownInlineSource{ public IEnumerable<DropdownItem> GetItems() { return new[] { new DropdownItem("Active", "active"), new DropdownItem("Inactive", "inactive"), new DropdownItem("Pending", "pending") }; }}
[MyInputComponent("dropdown", typeof(DropdownMetadataFactory))][HasConfiguration(typeof(DropdownAttribute), mandatory: true)]public class DropdownValue<T>{ public T? Value { get; set; }}
using UiMetadataFramework.Basic.Inputs.Typeahead;public class MyFormRequest{ [InputField(Label = "City")] [Typeahead(typeof(CitySource))] public TypeaheadValue<int> City { get; set; }}
public interface ITypeaheadRemoteSource{ // Implement as a form that returns TypeaheadResponse<T>}
Usage Example:
[Form("city-search")]public class CitySearch : ITypeaheadRemoteSource{ public class Request { public string Query { get; set; } } public class Response : FormResponse { public IEnumerable<TypeaheadItem<int>> Items { get; set; } }}
You can pass parameters to remote sources using RemoteSourceArgumentAttribute.
public class MyFormRequest{ [InputField(Label = "Country")] [Dropdown(typeof(CountrySource))] public DropdownValue<int> Country { get; set; } [InputField(Label = "City")] [Typeahead(typeof(CitySource))] [RemoteSourceArgument("countryId", "Country", "value")] public TypeaheadValue<int> City { get; set; }}
RemoteSourceArgumentAttribute Parameters:
parameter: Name of the request parameter on the remote source
source: Name of the input field to get the value from
sourceType: Type of value to extract (e.g., “value”)