Blazor playground

Nova v3.38.0

Preview

Blazor

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:

razor<NvButton Level="1">High Level</NvButton>

New Usage:

razor<NvButton Emphasis="NvButton.EmphasisEnum.high">High Emphasis</NvButton>

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:

razor<NvButton LeadingIcon="user" TrailingIcon="search">
  Old Usage
</NvButton>

New Usage:

razor<NvButton>
  <ChildContent>
    New Usage

  </ChildContent>

  <LeadingIconSlot><NvIcon Name="NvIcon.NameEnum.user"></NvIcon></LeadingIconSlot>

  <TrailingIconSlot><NvIcon Name="NvIcon.NameEnum.search"></NvIcon></TrailingIconSlot>
</NvButton>

New Properties#

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

New Usage:

razor<NvButton Danger="true">Dangerous Action</NvButton>

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

New Usage:

razor<NvButton Loading="true">Loading</NvButton>

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

New Usage:

razor<NvButton Emphasis="NvButton.EmphasisEnum.high">High Emphasis</NvButton>

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

New Usage:

razor<NvButton Fluid="true">Fluid</NvButton>