Blazor playground

Nova v3.37.0

Preview

Blazor

Welcome

Welcome to the Nova Design System - Blazor Edition

This Storybook is your end-to-end technical resource for building with Nova in Blazor. It provides interactive playgrounds, API documentation, and all the developer-focused guides you need to build efficiently.

You are currently viewing the Blazor implementation—a wrapper around our Native Web Components optimized for Blazor applications.

Understanding Our Architecture

To build effectively with Nova, it is essential to understand our core workflow. Our system is built on three key pillars:

1. Web Components

Our component library is built using StencilJS to create a single, framework-agnostic set of components (like <nv-button> or <nv-alert>). These are standard Web Components that work in any modern browser, with or without a JavaScript framework.

2. Design Tokens

All our design decisions—colors, spacing, typography, shadows—are stored as design tokens. These tokens are the single source of truth for Nova's visual style.

3. Tailwind CSS plugin

This is how you apply styling. Nova publishes its design tokens, typography, and utilities as a CSS-only Tailwind 4 plugin. When you want to style a component or build a new layout, you use Tailwind's utility classes (e.g., bg-level-00, typo-heading-lg-bold, p-4). This ensures your application is consistent with Nova's design language, right out of the box.

Note: If you are new to Tailwind CSS, we highly recommend visiting the official Tailwind CSS documentation to learn about its utility-first approach.

Your core workflow will be: Use a Nova Blazor component, and style it using our Tailwind utility classes.

Getting Started with Blazor

Follow these steps to get Nova integrated into your Blazor project. For the complete setup guide, see Introduction → Getting Started.

1. Install the NuGet Package

bashdotnet add package Nova.Design.System.Blazor

IMPORTANT
Keep the NuGet and npm versions in sync. This package relies on matching versions between the NuGet package and the npm base package @nova-design-system/nova-base used by the Tailwind pipeline and static assets. The build emits a warning whenever these versions do not match.

2. Configure Tailwind CSS

Install Tailwind and the Nova base package in your project directory:

bashnpm install tailwindcss@4.2.2 @tailwindcss/cli@4.2.2 @nova-design-system/nova-base@<version>

Create Styles/tailwind.css, choosing exactly one Nova theme:

css@import 'tailwindcss';
@import '@nova-design-system/nova-base/theme/plugin.css';
@import '@nova-design-system/nova-base/dist/css/spark.css';
/* Or import ocean.css instead of spark.css. */

No tailwind.config file, @config, @plugin, or JavaScript theme import is required.

Add a build target to your .csproj so the stylesheet is compiled:

xml<Target Name="BuildTailwindCSS" BeforeTargets="Build">
  <Exec Command="npx @tailwindcss/cli -i ./Styles/tailwind.css -o ./wwwroot/css/tailwind.css" />
</Target>

3. Reference Styles and Scripts

In _Host.cshtml (Server) or wwwroot/index.html (WebAssembly), reference the compiled stylesheet and the Nova scripts. The selected Nova theme is already bundled into tailwind.css:

html<link rel="stylesheet" href="css/tailwind.css" />

<script type="module" src="_content/Nova.Design.System.Blazor/nova/native.esm.js"></script>
<script src="_content/Nova.Design.System.Blazor/js/helper.js"></script>

Use helper.min.js instead of helper.js in production.

4. Import the Namespace

Add the Nova namespace to your _Imports.razor:

razor@using NovaComponents
@using NovaComponents.Models

5. Using Components in Blazor

Components in Blazor use a tag-based syntax similar to HTML, with strongly typed parameters:

razor@page "/example"

<NvButton Emphasis="NvButton.EmphasisEnum.high">
    Get Started
</NvButton>

<NvAlert Feedback="NvAlert.FeedbackEnum.information"
         Heading="This is an informational message." />

6. Working with Slots

Blazor components expose slots through ChildContent and named RenderFragment parameters, which are suffixed with Slot:

Default content (ChildContent):

razor<NvButton>Click Me</NvButton>

Named slots:

razor<NvButton>
    Both Sides
    <LeadingIconSlot>
        <NvIcon Name="user" />
    </LeadingIconSlot>
    <TrailingIconSlot>
        <NvIcon Name="filter" />
    </TrailingIconSlot>
</NvButton>

See Guides → Working with Slots for how to handle dynamically changing slot content.

Developer Resources

Component Library

You can browse all components alphabetically in the "Components" section of the sidebar. Each component page features:

  • Live Examples: Interactive playgrounds to see components in action.
  • Controls: A panel to modify component parameters in real-time.
  • API Documentation: A full table of properties, events, and slots.
  • Code Snippets: Copy-paste ready Blazor code for your implementation.

Changelog

We document all changes, including breaking changes, in the Changelog. Please review it when upgrading versions.

Blazor-Specific Features

Type Safety

All Nova Blazor components are strongly typed with full IntelliSense support, providing compile-time checking for properties and parameters. Enum parameters are nested in their component type, for example NvButton.SizeEnum.sm.

Event Handling

Events follow Blazor conventions using EventCallback:

razor<NvButton @onclick="HandleClick">Submit</NvButton>

@code {
    private void HandleClick()
    {
        // Handle the click
    }
}

Two-Way Binding

Many form components support @bind-Value syntax:

razor<NvFieldtext @bind-Value="userName" Label="Username" />

@code {
    private string userName = "";
}

Other Framework Implementations

While you're viewing the Blazor components, Nova also provides implementations for other frameworks:

  • React: Type-safe React components with React-style props
  • Vue: Vue 3 components with Vue-specific features
  • Angular: Angular components with full TypeScript support
  • Native: Pure Web Components for any framework or vanilla JavaScript

All implementations provide the same components with framework-specific DX improvements.

Connect With Us

Have a question, need support, or want to share feedback? Contact the Nova team directly on Microsoft Teams.

Note: These channels are only accessible to those working for Elia Group (Elia, 50Hertz, and subsidiaries).