Class InputSetBuilder<T>
- Namespace
- Htmx.Components.Models.Builders
- Assembly
- Htmx.Components.dll
Builder for creating InputSet instances with multiple input fields. Provides fluent configuration for groups of related input controls.
public class InputSetBuilder<T> : BuilderBase<InputSetBuilder<T>, InputSet> where T : class
Type Parameters
T
The model type that the input set is for
- Inheritance
-
InputSetBuilder<T>
- Inherited Members
- Extension Methods
Constructors
InputSetBuilder(IServiceProvider)
Initializes a new instance of the InputSetBuilder with the specified service provider.
public InputSetBuilder(IServiceProvider serviceProvider)
Parameters
serviceProvider
IServiceProviderThe service provider for dependency injection
Methods
AddInput(IInputModel)
Adds a pre-configured input model to the set. Useful when you have an existing IInputModel instance to add.
public InputSetBuilder<T> AddInput(IInputModel inputModel)
Parameters
inputModel
IInputModelThe input model to add to the set
Returns
- InputSetBuilder<T>
The current builder instance for method chaining
AddInput<TProp>(Expression<Func<T, TProp>>, Action<InputModelBuilder<T, TProp>>)
Adds an input field for the specified property with fluent configuration. Creates a strongly-typed input model that binds to the specified property.
public InputSetBuilder<T> AddInput<TProp>(Expression<Func<T, TProp>> propSelector, Action<InputModelBuilder<T, TProp>> configure)
Parameters
propSelector
Expression<Func<T, TProp>>Expression that selects the property to create an input for
configure
Action<InputModelBuilder<T, TProp>>Delegate to configure the input model builder
Returns
- InputSetBuilder<T>
The current builder instance for method chaining
Type Parameters
TProp
The type of the property being configured
AddRange(IEnumerable<IInputModel>)
Adds multiple pre-configured input models to the set. Allows for bulk addition of input models from another source.
public InputSetBuilder<T> AddRange(IEnumerable<IInputModel> inputModels)
Parameters
inputModels
IEnumerable<IInputModel>The collection of input models to add
Returns
- InputSetBuilder<T>
The current builder instance for method chaining
BuildImpl()
Builds the final InputSet instance with all configured input fields. This method is called internally to create the final result.
protected override Task<InputSet> BuildImpl()
Returns
- Task<InputSet>
A task that represents the asynchronous build operation, containing the built InputSet
WithLabel(string)
Sets the label for the input set. The label is typically displayed as a group header or section title.
public InputSetBuilder<T> WithLabel(string label)
Parameters
label
stringThe label text to display for the input set
Returns
- InputSetBuilder<T>
The current builder instance for method chaining