Field Checkbox

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.

TypeDefault Value
boolfalse
An error occur.
This is a hint
<NVFieldCheckbox  
  Name="Error"
  Label="Error"
  Error
  Message="This is a hint" 
  Validation="An error occur."
/>

Indeterminate

Set the Field as indeterminate.

TypeDefault Value
boolfalse
<NVFieldCheckbox Name="Indeterminate" Label="Indeterminate" Indeterminate MB="2" />
<NVFieldCheckbox Name="IndeterminateDisabled" Label="Indeterminate and Disabled" Indeterminate Disabled />

Label

Label define the label value of the Checkbox Field.

TypeDefault Value
stringnull
<NVFieldCheckbox Name="Label" Label="This is a label"/>

LabelBefore

TypeDefault Value
boolfalse
<NVFieldCheckbox Name="Label" Label="This is a label" LabelBefore/>

LabelBeforeWidth

TypeDefault Value
stringnull
<NVFieldCheckbox Name="Label" Label="This is a label" LabelBefore LabelBeforeWidth="250px"/>

Message

Message define a 'hint ' message for the Checkbox Field.

TypeDefault Value
stringnull
This is a message
<NVFieldCheckbox Label="Message" 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.

TypeDefault Value
stringnull
<NVFieldCheckbox Name="uniqueName" Label="This is a label"/>

NVFieldAfter

Add content after the 'input' element.

TypeDefault Value
RenderFragmentnull

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.

<NVFieldCheckbox Name="FieldAfter" Label="FieldAfter">
  <NVFieldAfter>
    <NVBlock Tag="p" Margin="1 . ." TextSize="sm">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.</NVBlock>
  </NVFieldAfter>
</NVFieldCheckbox>

NVFieldBefore

Add content before the 'input' element.

TypeDefault Value
RenderFragmentnull

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.

<NVFieldCheckbox Name="FieldBefore" Label="FieldBefore">
  <NVFieldBefore>
    <NVBlock Tag="p" Margin=". . 1" TextSize="sm">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ex nunc.</NVBlock>
  </NVFieldBefore>
</NVFieldCheckbox>

NVFieldLabel

NVFieldLabel define the content label of the Checkbox Field.

TypeDefault Value
RenderFragmentnull
<NVFieldCheckbox Name="FieldLabel">
  <NVFieldLabel>
    This is a <NVBlock Tag="strong" TextColor="error">label</NVBlock>
  </NVFieldLabel>
</NVFieldCheckbox>

NVFieldMessage

When you need a more complex (with html markups) message, you can use FieldMessage RenderFragment.

TypeDefault Value
RenderFragmentnull
This is a message with markups
<NVFieldCheckbox Label="FieldMessage" Name="FieldMessage">
  <NVFieldMessage>This is a message with <strong>markups</strong></NVFieldMessage>
</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.

TypeDefault Value
RenderFragmentnull
This is a validation message
<NVFieldCheckbox Name="FieldValidation" Label="FieldValidation" Error>
  <NVFieldValidation>This is a <strong>validation</strong> message</NVFieldValidation>
</NVFieldCheckbox>

Required

Set the Field as required. This adds an * after the label.

TypeDefault Value
boolfalse
<NVFieldCheckbox Name="Required" Label="Required" Required />

Success

Set the field in State 'success'.

TypeDefault Value
boolfalse
Well done !
This is a hint
<NVFieldCheckbox  
  Success 
  Name="Success"
  Label="Success"
  Message="This is a hint" 
  Validation="Well done !"
/>

Switch

When Switch is set to True, the checkbox will have the Switch 'UI'.

TypeDefault Value
boolfalse
<NVFieldCheckbox
  Label="Switch"
  Name="Switch"
  Switch
  Value="@true"
/>