Angular playground

Nova v3.38.0

Preview

Angular

Typography in code

The fonts, type styles and utility classes Nova applies to text.

Typography Guide for Nova Design System

Introduction#

Typography in Nova is built on a consistent, token-based system that ensures visual harmony across all digital products. This guide focuses on practical implementation and best practices for developers using Nova's typography utilities.

Key Principle: Nova uses utility classes that combine font-size, font-weight, and line-height into single, semantic class names. This ensures consistency and reduces the cognitive load of managing multiple typographic properties.

Font Family#

Nova uses TT Norms as the primary digital font for all interfaces.

When to use:

  • All user interfaces, web applications, and digital products
  • Component text, labels, buttons, forms
  • Dashboard content, data tables, navigation
  • Any interactive digital element

How to access: Contact the Nova Design System team for TT Norms license access

Typography Variants#

Nova provides three typography categories, each optimized for different content types:

1. Heading Typography#

Used for titles, section headers, and hierarchical content structure.

SizeClass NameFont SizeLine HeightAvailable Weights
3XLtypo-heading-3xl-{weight}60px60pxregular, medium, bold
2XLtypo-heading-2xl-{weight}48px48pxregular, medium, bold
XLtypo-heading-xl-{weight}36px40pxregular, medium, bold
LGtypo-heading-lg-{weight}30px32pxregular, medium, bold
MDtypo-heading-md-{weight}24px28pxregular, medium, bold
SMtypo-heading-sm-{weight}20px24pxregular, medium, bold
XStypo-heading-xs-{weight}18px24pxregular, medium, bold

Usage Example:

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-product-card',
  template: `
    <div>
      <h2 class="typo-heading-lg-bold">Product Features</h2>
      <h3 class="typo-heading-sm-medium">Advanced Analytics</h3>
      <p class="typo-text-md-regular">
        Real-time data visualization and insights.
      </p>
    </div>
  `
})
export class ProductCardComponent {}

2. Text Typography#

Used for body content, descriptions, labels, and general text.

SizeClass NameFont SizeLine HeightAvailable Weights
XLtypo-text-xl-{weight}20px30pxregular, medium, bold
LGtypo-text-lg-{weight}18px28pxregular, medium, bold
MDtypo-text-md-{weight}16px24pxregular, medium, bold
SMtypo-text-sm-{weight}14px20pxregular, medium, bold
XStypo-text-xs-{weight}12px16pxregular, medium, bold
XXStypo-text-xxs-{weight}10px12pxregular, medium, bold

Usage Example:

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-user-profile',
  template: `
    <div>
      <p class="typo-text-lg-regular">
        Welcome back, John!
      </p>
      <p class="typo-text-sm-regular">
        Last login: 2 hours ago
      </p>
      <label class="typo-text-xs-medium">
        Account Status
      </label>
    </div>
  `
})
export class UserProfileComponent {}

3. Mono Typography#

Used for code snippets, technical content, and monospaced requirements.

SizeClass NameFont SizeLine HeightAvailable Weights
MDtypo-mono-md-{weight}16px24pxregular, medium, bold
SMtypo-mono-sm-{weight}14px20pxregular, medium, bold
XStypo-mono-xs-{weight}12px16pxregular, medium, bold
XXStypo-mono-xxs-{weight}10px12pxregular, medium, bold

Usage Example:

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-code-example',
  template: `
    <div class="p-4 rounded">
      <code class="typo-mono-sm-regular">
        npm install @nova-design-system/nova-angular
      </code>
    </div>
  `
})
export class CodeExampleComponent {}

Naming Convention#

All typography classes follow a predictable naming pattern:

plaintexttypo-[usage]-[size]-[weight]

Pattern breakdown:

  • typo- - Prefix for all typography utilities
  • [usage] - One of: heading, text, or mono
  • [size] - One of: xl, lg, md, sm, or xs
  • [weight] - One of: regular, medium, or bold

Examples:

html<!-- Valid typography classes -->
<h1 class="typo-heading-xl-bold">Page Title</h1>
<p class="typo-text-md-regular">Body text content</p>
<code class="typo-mono-sm-medium">const x = 10;</code>

<!-- Invalid - doesn't follow naming convention -->
<h1 class="heading-xl">Title</h1>
<p class="text-md">Content</p>

Global HTML Element Styles#

Nova automatically styles common HTML elements with sensible defaults. You don't need to add typography classes to these elements unless you want to override the defaults:

ElementDefault Style Applied
<h1>typo-heading-xl-bold
<h2>typo-heading-lg-bold
<h3>typo-heading-md-bold
<h4>typo-heading-sm-medium
<h5>typo-heading-xs-medium
<p>typo-text-md-regular
<span>Inherits from parent
<label>typo-text-sm-medium
<legend>typo-text-md-medium
<small>typo-text-xs-regular
<a>typo-text-md-regular + link styles

Example - Using Global Styles:

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-article',
  template: `
    <article>
      <!-- These elements get automatic styling -->
      <h1>Article Title</h1>
      <h2>Section Header</h2>
      <p>This paragraph uses the default text-md-regular styling.</p>
      
      <!-- Override only when needed -->
      <p class="typo-text-lg-regular">
        This paragraph is larger than default.
      </p>
    </article>
  `
})
export class ArticleComponent {}

Best Practices#

DO: Use Complete Typography Classes#

Always use the full Nova typography class that includes size, weight, and line-height:

html<!-- Good - Complete typography utility -->
<h2 class="typo-heading-md-bold">Dashboard</h2>
<p class="typo-text-md-regular">View your analytics</p>
html<!-- Avoid - Mixing Tailwind atomic classes -->
<h2 class="text-2xl font-bold leading-tight">Dashboard</h2>
<p class="text-base font-normal">View your analytics</p>

DO: Combine with Tailwind Utilities for Color and Spacing#

Nova typography classes work seamlessly with Tailwind utilities:

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-features',
  template: `
    <div class="space-y-4">
      <h2 class="typo-heading-lg-bold">
        Features
      </h2>
      <p class="typo-text-md-regular mb-4">
        Explore our latest updates
      </p>
      <span class="typo-text-sm-medium uppercase">
        New
      </span>
    </div>
  `
})
export class FeaturesComponent {}

DO: Use Semantic HTML with Typography Classes#

Combine semantic HTML with appropriate typography:

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-blog-post',
  template: `
    <article>
      <header>
        <h1 class="typo-heading-xl-bold">Blog Post Title</h1>
        <time class="typo-text-sm-regular">
          March 15, 2024
        </time>
      </header>
      
      <section>
        <h2 class="typo-heading-md-medium">Introduction</h2>
        <p class="typo-text-md-regular">Article content here...</p>
      </section>
    </article>
  `
})
export class BlogPostComponent {}

DON'T: Mix Typography Systems#

Avoid mixing Nova typography with custom font sizing:

typescript// Bad - Inconsistent typography
@Component({
  selector: 'app-bad-example',
  template: `
    <div>
      <h2 class="typo-heading-lg-bold">Title</h2>
      <p [style.fontSize]="'17px'" [style.lineHeight]="1.7">
        Custom sized text
      </p>
    </div>
  `
})
export class BadExampleComponent {}

// Good - Consistent Nova typography
@Component({
  selector: 'app-good-example',
  template: `
    <div>
      <h2 class="typo-heading-lg-bold">Title</h2>
      <p class="typo-text-lg-regular">
        Properly sized text
      </p>
    </div>
  `
})
export class GoodExampleComponent {}

DON'T: Use Tailwind Font Size Utilities#

Nova typography classes already include font-size, so avoid Tailwind's text-{size} classes:

html<!-- Bad - Redundant and may conflict -->
<p class="typo-text-md-regular text-lg">Content</p>

<!-- Good - Use Nova typography alone -->
<p class="typo-text-lg-regular">Content</p>

Common Patterns#

Form Labels and Inputs#

typescriptimport { Component } from '@angular/core';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@Component({
  selector: 'app-login-form',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <form>
      <div class="space-y-2">
        <label class="typo-text-sm-medium">
          Email Address
        </label>
        <nv-field-text 
          type="email" 
          placeholder="Enter your email">
        </nv-field-text>
        <p class="typo-text-xs-regular">
          We'll never share your email
        </p>
      </div>
    </form>
  `
})
export class LoginFormComponent {}

Data Tables#

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-user-table',
  template: `
    <table>
      <thead>
        <tr>
          <th class="typo-text-sm-bold">Name</th>
          <th class="typo-text-sm-bold">Role</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td class="typo-text-md-regular">John Doe</td>
          <td class="typo-text-sm-regular">Admin</td>
        </tr>
      </tbody>
    </table>
  `
})
export class UserTableComponent {}

Cards and Content Blocks#

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-feature-card',
  template: `
    <div class="p-6">
      <h3 class="typo-heading-md-bold mb-2">
        Analytics Dashboard
      </h3>
      <p class="typo-text-md-regular mb-4">
        Track your metrics in real-time with advanced visualizations.
      </p>
      <span class="typo-text-sm-medium">
        Learn more →
      </span>
    </div>
  `
})
export class FeatureCardComponent {}

Code Blocks and Technical Content#

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-code-snippet',
  template: `
    <div class="rounded-lg p-4">
      <p class="typo-text-sm-medium mb-2">Installation</p>
      <pre class="typo-mono-sm-regular p-3 rounded">
        npm install @nova-design-system/nova-angular
      </pre>
      <p class="typo-text-xs-regular mt-2">
        Run this command in your project directory
      </p>
    </div>
  `
})
export class CodeSnippetComponent {}

Notification Messages#

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-notification',
  template: `
    <div class="border-l-4 p-4">
      <h4 class="typo-text-md-bold">
        New Update Available
      </h4>
      <p class="typo-text-sm-regular">
        Version 2.0 includes performance improvements and new components.
      </p>
    </div>
  `
})
export class NotificationComponent {}

Responsive Typography#

Nova typography classes are fixed sizes by default. For responsive typography, use Tailwind's responsive modifiers:

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-responsive-heading',
  template: `
    <h1 class="
      typo-heading-md-bold 
      md:typo-heading-lg-bold 
      lg:typo-heading-xl-bold
    ">
      Responsive Title
    </h1>
  `
})
export class ResponsiveHeadingComponent {}

Dynamic Typography with Angular#

Using ngClass for Conditional Typography#

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-dynamic-text',
  template: `
    <p [ngClass]="{
      'typo-text-lg-bold': isImportant,
      'typo-text-md-regular': !isImportant
    }">
      {{ message }}
    </p>
  `
})
export class DynamicTextComponent {
  isImportant = true;
  message = 'This is a dynamic message';
}

Using String Interpolation#

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-heading-levels',
  template: `
    <h2 [class]="'typo-heading-' + size + '-bold'">
      Dynamic Heading
    </h2>
  `
})
export class HeadingLevelsComponent {
  size: 'xl' | 'lg' | 'md' | 'sm' | 'xs' = 'lg';
}

Typography with Structural Directives#

typescriptimport { Component } from '@angular/core';

@Component({
  selector: 'app-user-list',
  template: `
    <div>
      <h2 class="typo-heading-md-bold mb-4">Users</h2>
      <ul>
        <li *ngFor="let user of users" class="typo-text-md-regular">
          <span class="typo-text-sm-medium">{{ user.name }}</span>
          <small class="typo-text-xs-regular">{{ user.email }}</small>
        </li>
      </ul>
    </div>
  `
})
export class UserListComponent {
  users = [
    { name: 'John Doe', email: 'john@example.com' },
    { name: 'Jane Smith', email: 'jane@example.com' }
  ];
}

Integration with Nova Angular Components#

Nova components work seamlessly with typography utilities:

typescriptimport { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@Component({
  selector: 'app-dashboard',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <div class="container mx-auto p-4">
      <h1 class="typo-heading-xl-bold mb-6">Dashboard</h1>
      
      <nv-button>
        <span class="typo-text-md-medium">Save Changes</span>
      </nv-button>
      
      <nv-card class="mt-4">
        <h3 class="typo-heading-sm-bold">Statistics</h3>
        <p class="typo-text-md-regular mt-2">
          View your performance metrics
        </p>
      </nv-card>
    </div>
  `
})
export class DashboardComponent {}

Debugging Typography Issues#

CSS Specificity Conflicts#

If typography doesn't apply, check for specificity issues:

css/* This might override Nova typography */
div p {
  font-size: 18px !important;
}

/* Use Nova classes with higher specificity */
.typo-text-md-regular {
  /* Nova's styles will apply */
}

Angular View Encapsulation#

Be aware of Angular's view encapsulation when using typography:

typescriptimport { Component, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'app-example',
  // Use None or Emulated based on your needs
  encapsulation: ViewEncapsulation.None,
  template: `
    <p class="typo-text-md-regular">This text uses Nova typography</p>
  `,
  styles: [`
    /* Custom styles that work with Nova typography */
    p {
      margin-bottom: 1rem;
    }
  `]
})
export class ExampleComponent {}

Resources#

Design Tokens#

Font Access#