Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
Error
You can use this bool to manually set the field in State 'error'.
The Field need to receive a cascaded EditContext. The Error and ValidationMessage will be manage automatically by the EditContext.
Type
Default Value
bool
false
An error occur.
This is a hint
<NVFieldCheckboxName="Error"Label="Error"ErrorMessage="This is a hint"Validation="An error occur."
/>
<divclass="nv-field nv-field-checkbox nv-field-error"><labelfor="Error"class="nv-field-label">Error</label><divclass="nv-field-input"><inputid="Error"name="Error"autocomplete="off"type="checkbox"></div><divclass="nv-field-message"><divclass="nv-field-validation">An error occur.</div><div>This is a hint</div></div></div>
<nv-fieldcheckboxname="Error"label="Error"message="This is a hint"validation="An error occur."error></nv-fieldcheckbox>
<NvFieldCheckboxerrorlabel="Error"message="This is a hint"name="Error"validation="An error occur."
/>
Indeterminate
Set the Field as indeterminate.
Type
Default Value
bool
false
<NVFieldCheckboxName="Indeterminate"Label="Indeterminate"IndeterminateMB="2" /><NVFieldCheckboxName="IndeterminateDisabled"Label="Indeterminate and Disabled"IndeterminateDisabled />
<nv-fieldcheckboxlabel="Indeterminate"name="Indeterminate"mb="2"indeterminate></nv-fieldcheckbox><nv-fieldcheckboxname="IndeterminateDisabled"label="Indeterminate and Disabled"disabledindeterminate></nv-fieldcheckbox>
<NvFieldCheckboxindeterminatelabel="Indeterminate"mb="2"name="Indeterminate" /><NvFieldCheckboxdisabledindeterminatelabel="Indeterminate and Disabled"name="IndeterminateDisabled" />
Label
Label define the label value of the Checkbox Field.
Type
Default Value
string
null
<NVFieldCheckboxName="Label"Label="This is a label"/>
<divclass="nv-field nv-field-checkbox"><labelclass="nv-field-label"for="Label">This is a label</label><divclass="nv-field-input"><inputautocomplete="off"type="checkbox"id="Label"name="Label"></div></div>
<nv-fieldcheckboxname="Label"label="This is a label"></nv-fieldcheckbox>
<NvFieldCheckboxlabel="This is a label"name="Label" />
LabelBefore
Type
Default Value
bool
false
<NVFieldCheckboxName="Label"Label="This is a label"LabelBefore/>
<divclass="nv-field nv-field-checkbox nv-field-label-before"><labelclass="nv-field-label"for="Label">This is a label</label><divclass="nv-field-input"><inputautocomplete="off"type="radio"id="Label"name="Label"></div></div>
<nv-fieldcheckboxname="Label"label="This is a label"labelbefore></nv-fieldcheckbox>
<NvFieldCheckboxlabel="This is a label"labelBeforename="Label" />
LabelBeforeWidth
Type
Default Value
string
null
<NVFieldCheckboxName="Label"Label="This is a label"LabelBeforeLabelBeforeWidth="250px"/>
<divclass="nv-field nv-field-checkbox nv-field-label-before"><labelclass="nv-field-label"for="Label"style="width: 250px">This is a label</label><divclass="nv-field-input"><inputautocomplete="off"type="radio"id="Label"name="Label"></div></div>
<nv-fieldcheckboxname="Label"label="This is a label"labelbeforelabelbeforewidth="250px"></nv-fieldcheckbox>
<NvFieldCheckboxlabel="This is a label"labelBeforelabelBeforeWidth="250px"name="Label" />
Message
Message define a 'hint ' message for the Checkbox Field.
Type
Default Value
string
null
This is a message
<NVFieldCheckboxLabel="Message"Message="This is a message"/>
<divclass="nv-field nv-field-checkbox"><labelfor="Message"class="nv-field-label">Message</label><divclass="nv-field-input"><inputid="Message"Name="Message"autocomplete="off"type="checkbox"></div><divclass="nv-field-message"><div>This is a message</div></div></div>
<nv-fieldcheckboxlabel="Checkbox"message="This is a message"></nv-fieldcheckbox>
<NvFieldCheckboxlabel="Checkbox"message="This is a message" />
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
<NVFieldCheckboxName="uniqueName"Label="This is a label"/>
<divclass="nv-field nv-field-checkbox"><labelclass="nv-field-label"for="uniqueName">This is a label</label><divclass="nv-field-input"><inputautocomplete="off"type="checkbox"id="uniqueName"name="uniqueName"></div></div>
<nv-fieldcheckboxlabel="This is a label"name="uniqueName"></nv-fieldcheckbox>
<NvFieldCheckboxlabel="This is a label"name="uniqueName" />
NVFieldAfter
Add content after the 'input' element.
Type
Default Value
RenderFragment
null
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.
<NVFieldCheckboxName="FieldAfter"Label="FieldAfter"><NVFieldAfter><NVBlockTag="p"Margin="1 . ."TextSize="sm">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.</NVBlock></NVFieldAfter></NVFieldCheckbox>
<divclass="nv-field nv-field-checkbox"><labelclass="nv-field-label"for="FieldAfter">FieldAfter</label><divclass="nv-field-input"><inputautocomplete="off"type="checkbox"id="FieldAfter"name="FieldAfter"></div><divclass="nv-field-input-plugin"><pclass="text-sm mt-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.</p></div></div>
<nv-fieldcheckboxname="After"label="After"id="checkbox1"><nv-blockslot="after"margin="1 . ."textsize="sm">This is a message with <strong> markups</strong></nv-block></nv-fieldcheckbox>
<NvFieldCheckboxname="After"label="After"id="checkbox1"><NvBlockslot="after"margin="1 . ."textSize="sm"> This is a message with <strong> markups</strong></NvBlock></NvFieldCheckbox>
NVFieldBefore
Add content before the 'input' element.
Type
Default Value
RenderFragment
null
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.
<NVFieldCheckboxName="FieldBefore"Label="FieldBefore"><NVFieldBefore><NVBlockTag="p"Margin=". . 1"TextSize="sm">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.</NVBlock></NVFieldBefore></NVFieldCheckbox>
<divclass="nv-field nv-field-checkbox"><labelclass="nv-field-label"for="FieldBefore">FieldBefore</label><divclass="nv-field-input-plugin"><pclass="text-sm mb-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.</p></div><divclass="nv-field-input"><inputautocomplete="off"type="checkbox"id="FieldBefore"name="FieldBefore"></div></div>
<nv-fieldcheckboxname="Before"label="Before"id="checkbox1"><nv-blockslot="before"margin="1 . ."textsize="sm">This is a message with <strong> markups</strong></nv-block></nv-fieldcheckbox>
<NvFieldCheckboxname="Before"label="Before"id="checkbox1"><NvBlockslot="before"margin="1 . ."textSize="sm"> This is a message with <strong> markups</strong></NvBlock></NvFieldCheckbox>
NVFieldLabel
NVFieldLabel define the content label of the Checkbox Field.
Type
Default Value
RenderFragment
null
<NVFieldCheckboxName="FieldLabel"><NVFieldLabel>
This is a <NVBlockTag="strong"TextColor="error">label</NVBlock></NVFieldLabel></NVFieldCheckbox>
<divclass="nv-field nv-field-checkbox"><labelclass="nv-field-label"for="FieldLabel">
This is a <strongclass="text-error">label</strong></label><divclass="nv-field-input"><inputautocomplete="off"type="checkbox"id="FieldLabel"name="FieldLabel"></div></div>
<nv-fieldcheckboxname="FielLabel"><divslot="label">This is a <strong>label</strong></div></nv-fieldcheckbox>
<NvFieldCheckboxname="FielLabel"><divslot="label"> This is a <strong>label</strong></div></NvFieldCheckbox>
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 with markups
<NVFieldCheckboxLabel="FieldMessage"Name="FieldMessage"><NVFieldMessage>This is a message with <strong>markups</strong></NVFieldMessage></NVFieldCheckbox>
<divclass="nv-field nv-field-checkbox mb-3"><labelclass="nv-field-label"for="FieldMessage">FieldMessage</label><divclass="nv-field-input"><inputid="FieldMessage"name="FieldMessage"autocomplete="off"type="checkbox"></div><divclass="nv-field-message"><divclass="nv-field-validation">This is a message with <strong>markups</strong></div></div></div>
<nv-fieldcheckboxlabel="Field Message"><divslot="message">This is a message with <strong>markups</strong></div></nv-fieldcheckbox>
<NvFieldCheckboxlabel="Field Message"><divslot="message"> This is a message with <strong>markups</strong></div></NvFieldCheckbox>
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 a validation message
<NVFieldCheckboxName="FieldValidation"Label="FieldValidation"Error><NVFieldValidation>This is a <strong>validation</strong> message</NVFieldValidation></NVFieldCheckbox>
<divclass="nv-field nv-field-checkbox nv-field-error mb-3"><labelclass="nv-field-label"for="FieldValidation">FieldValidation</label><divclass="nv-field-input"><inputid="FieldValidation"name="FieldValidation"autocomplete="off"type="checkbox"></div><divclass="nv-field-message"><divclass="nv-field-validation">This is a <strong>validation</strong> message</div></div></div>
<nv-fieldcheckboxerror="true"label="Field Validation Error"><divslot="validation"> This is a <strong>validation</strong> message </div></nv-fieldcheckbox>
<NvFieldCheckboxerrorlabel="Field Validation Error"><divslot="validation"> This is a <strong>validation</strong> message </div></NvFieldCheckbox>
Required
Set the Field as required. This adds an * after the label.
<NVFieldCheckboxSuccessName="Success"Label="Success"Message="This is a hint"Validation="Well done !"
/>
<divclass="nv-field nv-field-checkbox nv-field-success"><labelfor="Success"class="nv-field-label">Success</label><divclass="nv-field-input"><inputid="Success"name="Success"autocomplete="off"type="checkbox"></div><divclass="nv-field-message"><divclass="nv-field-validation">Well done !</div><div>This is a hint</div></div></div>
<NvFieldCheckboxid="checkbox1"label="Success"message="This is a hint"name="Success"successvalidation="Well done !"
/>
<NvFieldCheckboxid="checkbox1"label="Success"message="This is a hint"name="Success"successvalidation="Well done !" />
Switch
When Switch is set to True, the checkbox will have the Switch 'UI'.