Func used to get the string value of an item within the Options parameter. Need to be defined if you used the Options parameter.
Type
Default Value
Func<TValue?, string>?
null
<NVFieldSelect
@bind-Value="@_model.FieldOptionSelectModel"TValue="FieldOptionSelect"Placeholder="select a FieldOptionSelect"Options="@(_options)"ForOptionValue="@((item) => item?.Id)"ForOptionLabel="@((item) => item?.Name)"Label="ForOptionValue"Name="ForOptionValue" />
@{
private static FieldOptionSelect[] _options = new FieldOptionSelect[]
{
new() {Id = "FieldOptionSelect Id 1", Name = "FieldOptionSelect Name 1"},
new() {Id = "FieldOptionSelect Id 2", Name = "FieldOptionSelect Name 2"},
new() {Id = "FieldOptionSelect Id 3", Name = "FieldOptionSelect Name 3"}
};
}
...
public class FieldOptionSelect
{
public string Id { get; set; } = default!;
public string Name { get; set; } = default!;
}
<divclass="nv-field nv-field-select"><labelclass="nv-field-label"for="ForOptionValue">
ForOptionValue
</label><divclass="nv-field-input"><selectid="ForOptionValue"name="ForOptionValue"><optiondisabledselected="selected"value="">select a FieldOptionSelect</option><optionvalue="FieldOptionSelect Id 1">FieldOptionSelect Name 1</option><optionvalue="FieldOptionSelect Id 2">FieldOptionSelect Name 2</option><optionvalue="FieldOptionSelect Id 3">FieldOptionSelect Name 3</option></select></div></div>
ForOptionLabel
Func used to get the string label of an item within the Options parameter. If not set, ForOptionValue Func will be used for the label of the option of the select.
Type
Default Value
Func<TValue?, string>?
null
<NVFieldSelect
@bind-Value="@_model.FieldOptionSelectModel"TValue="FieldOptionSelect"Placeholder="select a FieldOptionSelect"Options="@(_options)"ForOptionValue="@((item) => item?.Id)"ForOptionLabel="@((item) => item?.Name)"Label="ForOptionLabel"Name="ForOptionLabel" />
@{
private static FieldOptionSelect[] _options = new FieldOptionSelect[]
{
new() {Id = "FieldOptionSelect Id 1", Name = "FieldOptionSelect Name 1"},
new() {Id = "FieldOptionSelect Id 2", Name = "FieldOptionSelect Name 2"},
new() {Id = "FieldOptionSelect Id 3", Name = "FieldOptionSelect Name 3"}
};
}
...
public class FieldOptionSelect
{
public string Id { get; set; } = default!;
public string Name { get; set; } = default!;
}
<divclass="nv-field nv-field-select"><labelclass="nv-field-label"for="ForOptionLabel">
ForOptionLabel
</label><divclass="nv-field-input"><selectid="ForOptionLabel"name="ForOptionLabel"><optiondisabledselected="selected"value="">select a FieldOptionSelect</option><optionvalue="FieldOptionSelect Id 1">FieldOptionSelect Name 1</option><optionvalue="FieldOptionSelect Id 2">FieldOptionSelect Name 2</option><optionvalue="FieldOptionSelect Id 3">FieldOptionSelect Name 3</option></select></div></div>
Label
Label define the label value of the Select.
Type
Default Value
string
null
<NVFieldSelectName="labelSample"Label="This is a label"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></NVFieldSelect>
<divclass="nv-field nv-field-select"><labelclass="nv-field-label"for="labelSample">This is a label</label><divclass="nv-field-input"><selectautocomplete="off"id="labelSample"name="labelSample"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></select></div></div>
<nv-fieldselectlabel="This is a label"name="labelSample"><nv-optionvalue="value-1">label 1</nv-option><nv-optionvalue="value-2">label 2</nv-option><nv-optionvalue="value-3">label 3</nv-option></nv-fieldselect>
<NvFieldSelectlabel="This is a label"name="labelSample"><NvOptionvalue="value-1"> label 1 </NvOption><NvOptionvalue="value-2"> label 2 </NvOption><NvOptionvalue="value-3"> label 3 </NvOption></NvFieldSelect>
Message
Message define a 'hint ' message for the Select.
Type
Default Value
string
null
This is a message
<NVFieldSelectMessage="This is a message"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></NVFieldSelect>
<divclass="nv-field nv-field-select"><divclass="nv-field-input"><selectautocomplete="off"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></select></div><divclass="nv-field-message"><div>This is a message</div></div></div>
<nv-fieldselectmessage="This is a message"><nv-optionvalue="value-1">label 1</nv-option><nv-optionvalue="value-2">label 2</nv-option><nv-optionvalue="value-3">label 3</nv-option></nv-fieldselect>
<NvFieldSelectmessage="This is a message"><NvOptionvalue="value-1"> label 1 </NvOption><NvOptionvalue="value-2"> label 2 </NvOption><NvOptionvalue="value-3"> label 3 </NvOption></NvFieldSelect>
Name
Name define the unique name for a field. It will add name and id attributes of the input. If there is a label will also add the for attribute to the label.
When for is provided to a label element and when an id is provided, with the same value, to an input element, the label click will focus the input.
If an EditContext is provided by the EditForm, the FieldIdentifier.FieldName will be used.
If you don't pass a this parameter, an autoName will be generated and used within attributes of input and label.
Type
Default Value
string
null
<NVFieldSelectName="uniqueName"Label="This is a label"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></NVFieldSelect>
<divclass="nv-field nv-field-select"><labelclass="nv-field-label"for="uniqueName">This is a label</label><divclass="nv-field-input"><selectautocomplete="off"id="uniqueName"name="uniqueName"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></select></div></div>
<nv-fieldselectlabel="This is a label"name="uniqueName"><nv-optionvalue="value-1">label 1</nv-option><nv-optionvalue="value-2">label 2</nv-option><nv-optionvalue="value-3">label 3</nv-option></nv-fieldselect>
<NvFieldSelectlabel="This is a label"name="uniqueName"><NvOptionvalue="value-1"> label 1 </NvOption><NvOptionvalue="value-2"> label 2 </NvOption><NvOptionvalue="value-3"> label 3 </NvOption></NvFieldSelect>
NVFieldLabel define the content of the label of the Select.
Type
Default Value
RenderFragment
null
<NVFieldSelectName="FieldLabel"><ChildContent><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></ChildContent><NVFieldLabel>
This is a <NVBlockTag="strong"TextColor="error">label</NVBlock></NVFieldLabel></NVFieldSelect>
<divclass="nv-field nv-field-select"><labelclass="nv-field-label"for="FieldLabel">
This is a <strongclass="text-error">label</strong></label><divclass="nv-field-input"><selectautocomplete="off"id="FieldLabel"name="FieldLabel"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></select></div></div>
<nv-fieldselectname="FieldLabel"><divslot="label"> This is a <nv-blocktag="strong"textcolor="error">label</nv-block></div><nv-optionvalue="value-1">label 1</nv-option><nv-optionvalue="value-2">label 2</nv-option><nv-optionvalue="value-3">label 3</nv-option></nv-fieldselect>
<NvFieldSelectname="FieldLabel"><divslot="label"> This is a{' '} <NvBlocktag="strong"textColor="error"> label </NvBlock></div><NvOptionvalue="value-1">label 1</NvOption><NvOptionvalue="value-2">label 2</NvOption><NvOptionvalue="value-3">label 3</NvOption></NvFieldSelect>
NVFieldMessage
When you need a more complex (with html markups) message, you can use FieldMessage RenderFragment.
Type
Default Value
RenderFragment
null
This is a message
<NVFieldSelect><ChildContent><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></ChildContent><NVFieldMessage>This is a <strong>message</strong></NVFieldMessage></NVFieldSelect>
<divclass="nv-field nv-field-select"><divclass="nv-field-input"><selectautocomplete="off"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></select></div><divclass="nv-field-message"><div>This is a <strong>message</strong></div></div></div>
<nv-fieldselect><divslot="message">This is a message with <strong>markups</strong></div><nv-optionvalue="value-1">label 1</nv-option><nv-optionvalue="value-2">label 2</nv-option><nv-optionvalue="value-3">label 3</nv-option></nv-fieldselect>
<NvFieldSelect><divslot="message"> This is a message with <strong>markups</strong></div><NvOptionvalue="value-1">label 1</NvOption><NvOptionvalue="value-2">label 2</NvOption><NvOptionvalue="value-3">label 3</NvOption></NvFieldSelect>
NVFieldValidation
When you need a more complex (with html markups) Validation message, you can use FieldValidation RenderFragment. It will override the Validation message, coming from Model/EditContext or from Validation Parameter.
Type
Default Value
RenderFragment
null
This is an error
<NVFieldSelectError><ChildContent><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option><ChildContent><NVFieldValidation>This is an <strong>error</strong></NVFieldValidation></NVFieldSelect>
<divclass="nv-field nv-field-select nv-field-error"><divclass="nv-field-input"><selectautocomplete="off"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></select></div><divclass="nv-field-message"><divclass="nv-field-validation">This is an <strong>error</strong></div></div></div>
<nv-fieldselecterror="true"><divslot="validation"> This is a <strong>validation</strong> message </div><nv-optionvalue="value-1">label 1</nv-option><nv-optionvalue="value-2">label 2</nv-option><nv-optionvalue="value-3">label 3</nv-option></nv-fieldselect>
<NvFieldSelecterror><divslot="validation"> This is a <strong>error</strong> message </div><NvOptionvalue="value-1">label 1</NvOption><NvOptionvalue="value-2">label 2</NvOption><NvOptionvalue="value-3">label 3</NvOption></NvFieldSelect>
Options
Array of options used for the select. Need to be used with ForOptionValue/ForOptionLabel parameter.
Type
Default Value
TValue[]?
null
<NVFieldSelect
@bind-Value="@_model.FieldOptionSelectModel"TValue="FieldOptionSelect"Placeholder="select a FieldOptionSelect"Options="@(_options)"ForOptionValue="@((item) => item?.Id)"ForOptionLabel="@((item) => item?.Name)"Label="FieldOptionSelect"Name="FieldOptionSelect" />
@{
private static FieldOptionSelect[] _options = new FieldOptionSelect[]
{
new() {Id = "FieldOptionSelect Id 1", Name = "FieldOptionSelect Name 1"},
new() {Id = "FieldOptionSelect Id 2", Name = "FieldOptionSelect Name 2"},
new() {Id = "FieldOptionSelect Id 3", Name = "FieldOptionSelect Name 3"}
};
}
...
public class FieldOptionSelect
{
public string Id { get; set; } = default!;
public string Name { get; set; } = default!;
}
<divclass="nv-field nv-field-select"><labelclass="nv-field-label"for="FieldOptionSelect">
FieldOptionSelect
</label><divclass="nv-field-input"><selectid="FieldOptionSelect"name="FieldOptionSelect"><optiondisabledselected="selected"value="">select a FieldOptionSelect</option><optionvalue="FieldOptionSelect Id 1">FieldOptionSelect Name 1</option><optionvalue="FieldOptionSelect Id 2">FieldOptionSelect Name 2</option><optionvalue="FieldOptionSelect Id 3">FieldOptionSelect Name 3</option></select></div></div>
Placeholder
Placeholder define the placeholder value of the Select.
Type
Default Value
string
null
<NVFieldSelectPlaceholder="This is a placeholder"><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></NVFieldSelect>
<divclass="nv-field nv-field-select"><divclass="nv-field-input"><selectautocomplete="off"><optionvalue=""disabledselected>This is a placeholder</option><optionvalue="value-1">label 1</option><optionvalue="value-2">label 2</option><optionvalue="value-3">label 3</option></select></div></div>