Native Web Components playground

Nova v3.37.0

Preview

Web Components

nv-button migration

Replacing the removed level, color, cta and icon props.

← nv-button

Migration Guide for nv-button

In the latest version of the nv-button component, we've made several important changes to the properties to improve usability and consistency. Below is a guide to help you update your existing buttons from version 2 to version 3.

Breaking Changes

1. prop color -> removed

We no longer support the color property. If you need to apply a color to your button, use CSS classes instead. There is one exception to this rule: the danger property, which will visually indicate the button represents a dangerous action.

2. prop level -> removed, use emphasis instead

The level property has been removed. We now use the emphasis property that describes the button's level of emphasis. This change aligns the property name more closely with its function, which is to indicate the importance of the button.

Old Usage:

html<nv-button level={1}>High Level</nv-button>

New Usage:

html<nv-button emphasis="high">High Emphasis</nv-button>

3. prop cta -> removed

The cta property has been removed. It is not longer supported and not part of the updated Nova design system. Use a high emphasis button instead.

4. prop icon -> removed

The icon property has been removed. Use the new nv-button-icon component instead.

5. prop leadingIcon and trailingIcon -> use slots instead

The leadingIcon and trailingIcon properties have been removed. Use the new leading-icon and trailing-icon slots instead.

Old Usage:

html<nv-button leadingIcon="user" trailingIcon="search">
  Old Usage
</nv-button>

New Usage:

html<nv-button>
  New Usage
  <nv-icon slot="leading-icon" name="user"></nv-icon>
  <nv-icon slot="trailing-icon" name="search"></nv-icon>
</nv-button>

New Properties

1. danger: Applies styling that visually indicates the button represents a dangerous action.

New Usage:

html<nv-button danger>Dangerous Action</nv-button>

2. loading: Set this to true to show a spinner on the button.

New Usage:

html<nv-button loading>Loading</nv-button>

3. emphasis: Adjusts the button’s emphasis to make it more or less visually prominent.

New Usage:

html<nv-button emphasis="high">High Emphasis</nv-button>

4. fluid: Allows the button to stretch and fill the entire width.

New Usage:

html<nv-button fluid>Fluid</nv-button>