CSS & Fonts
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
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');| Family | Weight | Style | File |
|---|---|---|---|
| Benton Sans | normal | normal | BentonSans-Book |
| Benton Sans | 100 | normal | BentonSans-Light |
| Benton Sans | normal | italic | BentonSans-Book_Italic |
| Benton Sans | 500 | normal | BentonSans-SemiDemi |
| Benton Sans | bold | normal | BentonSans-Medium |
| Benton Sans Low-DPI | normal | normal | BentonSans-SemiDemi |
| Benton Sans Low-DPI | normal | italic | BentonSans-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/fontsRoboto
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.