Table of Contents

Class InputModel<T, TProp>

Namespace
Htmx.Components.Models
Assembly
Htmx.Components.dll

Represents a strongly-typed input field for a specific property of type TProp on model type T.

public class InputModel<T, TProp> : IInputModel

Type Parameters

T

The model type that contains the property

TProp

The type of the property being edited

Inheritance
InputModel<T, TProp>
Implements
Inherited Members
Extension Methods

Properties

Attributes

Gets additional HTML attributes to apply to the input element. Allows for custom attributes, data attributes, and other HTML properties.

public Dictionary<string, string> Attributes { get; }

Property Value

Dictionary<string, string>

CssClass

Gets or sets the CSS class names to apply to the input element. Used for styling and layout purposes.

public string? CssClass { get; set; }

Property Value

string

Id

Gets or sets the unique identifier for this input control. Used as the HTML id attribute and for referencing the input in JavaScript.

public string Id { get; set; }

Property Value

string

Kind

Gets or sets the type of input control to render. Determines the HTML input type and behavior (text, number, select, etc.).

public InputKind Kind { get; set; }

Property Value

InputKind

Label

Gets or sets the display label for this input. Shown to users as the field name or description.

public string Label { get; set; }

Property Value

string

ModelHandler

Gets or sets the model handler that manages operations for the parent model. Provides access to CRUD operations and metadata for the model type.

public ModelHandler ModelHandler { get; set; }

Property Value

ModelHandler

ObjectValue

Gets or sets the current value as an object for cases where type conversion is needed. Used for flexible value handling in dynamic scenarios.

public object? ObjectValue { get; set; }

Property Value

object

Options

Gets or sets the options available for selection inputs (radio, select, checkbox lists). Each key-value pair represents a selectable option where the key is the value and value is the display text.

public List<KeyValuePair<string, string>>? Options { get; set; }

Property Value

List<KeyValuePair<string, string>>

Placeholder

Gets or sets the placeholder text displayed when the input is empty. Provides guidance to users about expected input format or content.

public string? Placeholder { get; set; }

Property Value

string

PropName

Gets or sets the name of the property this input represents. Used for binding to the specific property on the model.

public string PropName { get; set; }

Property Value

string

TypeId

Gets or sets the type identifier for the model this input belongs to. Used to identify the model type in form submissions and routing.

public string TypeId { get; set; }

Property Value

string

Value

Gets the string representation of the input's value. Converts the ObjectValue to a string suitable for HTML input elements.

public string Value { get; }

Property Value

string