React playground

Nova v3.37.0

Preview

React

nv-fieldcheckbox migration

Replacing message, validation and labelBefore with the current props.

← nv-fieldcheckbox

Migration Guide for nv-fieldcheckbox

In the latest version of the nv-fieldcheckbox component, several properties have been deprecated to improve consistency and usability. This guide provides instructions on updating your existing implementations to accommodate these changes.

Deprecations

1. prop message

The message property has been deprecated in favor of description. This change reflects the property's purpose, which is to provide additional context or information about the checkbox.

Old Usage:

html<nv-fieldcheckbox message="Additional info"></nv-fieldcheckbox>

New Usage:

html<nv-fieldcheckbox description="Additional info"></nv-fieldcheckbox>

2. Property validation

The validation property has been deprecated in favor of error-description. This change clarifies that this property is used to describe an error related to the checkbox.

Old Usage:

html<nv-fieldcheckbox validation="Error occurred"></nv-fieldcheckbox>

New Usage:

html<nv-fieldcheckbox error-description="Error occurred"></nv-fieldcheckbox>

3. Property labelBefore

The labelBefore property has been deprecated. Instead, use labelplacement="start" to specify that the label should appear before the checkbox.

Old Usage:

html<nv-fieldcheckbox labelBefore="true"></nv-fieldcheckbox>

New Usage:

html<nv-fieldcheckbox labelplacement="start"></nv-fieldcheckbox>

Breaking Changes

1. Property switch

The switch property has been deprecated as the switch functionality has been separated into a new control. If you need switch behavior, please use the nv-switch component provided separately.

2. Event onChange -> checkedChange

The onChange event has been replaced by the checkedChange event. This change provides a more descriptive naming convention, indicating that the event is specifically related to changes in the checkbox's checked state. The event is emitted using the checkedChange: EventEmitter<boolean> to provide a clear and type-safe way to handle changes in the checked state.

Old Usage:

html<nv-fieldcheckbox onChange="handleCheckboxChange"></nv-fieldcheckbox>

New Usage:

html<nv-fieldcheckbox @checkedChange="handleCheckboxChange"></nv-fieldcheckbox>

3. Property labelBeforeWidth

The labelBeforeWidth property has been deprecated. Labels now default to the stretch position, meaning they will take up the available space. If you want the label to appear after the checkbox, you can use labelPlacement="after".