Tableau UI for Angular

CSS & Fonts

The library's styles, which an app uses once, and the fonts its text is set in.

The styles

Use them once, in the app's global stylesheet. They are SCSS: an app made with CSS renames src/styles.css to src/styles.scss, there and in angular.json. as libStyles names them for font-import, below.

@use 'tableau-ui-angular/styles/lib-styles' as libStyles;

They hold the theme's custom properties, which Theming lists, and the components' shared styles. They also style the page: its font, size and colours, the headings h1 to h4, links, scrollbars, and a few text classes.

.text-page-title, as h1

.text-title, as h2

.text-subtitle, as h3

.text-body-large, as h4

.text-large

.text, the body's size

.text-light

.text-primary

A link

Weight 100Weight 400Weight 500Weight 700Italic

import { ChangeDetectionStrategy, Component } from '@angular/core';

// The library's styles style the text; the component imports no module
@Component({
  selector: 'app-css-text-example',
  templateUrl: './css-text.example.html',
  styleUrl: './css-text.example.scss',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CssTextExampleComponent {
  // The weights font-import gives Benton Sans
  protected readonly weights = [100, 400, 500, 700];
}

Fonts

The text is set in the first of these fonts the browser has, from --twc-font-family: 'Benton Sans', 'Roboto', arial, helvetica, sans-serif. On a screen of 120 dpi or less, it is 'Benton Sans Low-DPI', 'Roboto', arial, helvetica, sans-serif.

Benton Sans

Tableau's font, which needs a licence. font-import declares its faces, given the URL the app serves its files at: /fonts for public/fonts. Each face loads its file's WOFF2, or else its WOFF.

@include libStyles.font-import('/fonts');
FamilyWeightStyleFile
Benton SansnormalnormalBentonSans-Book
Benton Sans100normalBentonSans-Light
Benton SansnormalitalicBentonSans-Book_Italic
Benton Sans500normalBentonSans-SemiDemi
Benton SansboldnormalBentonSans-Medium
Benton Sans Low-DPInormalnormalBentonSans-SemiDemi
Benton Sans Low-DPInormalitalicBentonSans-SemiDemi_Italic

A Tableau Server you own has the files, and the script the package ships downloads them into the folder. Add-Benton-Sans.md has the steps.

node node_modules/tableau-ui-angular/styles/fonts/downloadFonts.js https://your-tableau-server public/fonts

Roboto

Google's open font, which this site loads in its styles.scss:

@import 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap';

Arial and Helvetica

Then Arial, Helvetica and the browser's sans-serif, with nothing to load.