Current version 22.5.0

Themes

tg2 components take their colours from CSS custom properties, so the theme is picked at runtime. Changing it needs no SCSS rebuild.

Include the tokens

The theme tokens come with Tangram's global styles. If your app already includes them, there's nothing to add.

// styles.scss
@use '@trademe/tangram/tangram';

The themes

tg2 themes
ThemeUse it forHow it's set
tg2-lightThe tg2 design. The defaultNothing to set: it's the :root default
tg2-darkThe tg2 design in dark modedata-tg-theme="tg2-dark" or [theme]
tg-lightKeeping the existing Tangram look while you migrate to tg2 componentsdata-tg-theme="tg-light" or [theme]
tg-darkThe existing Tangram look in dark modedata-tg-theme="tg-dark" or [theme]

Apply a theme

There are two ways to apply a theme. Both rely on CSS custom property inheritance, so no SCSS rebuild is needed.

Option 1 — per component

Set [theme] on each component. Use this when only a few components on a page need a different theme.

<button tg2Button [theme]="'tg2-dark'">Button</button>

<tg2-input-container label="Title" [theme]="'tg2-dark'">
    <input tg2Input required />
</tg2-input-container>

Option 2 — whole page or container

Set data-tg-theme="tg2-dark" on <html> or any ancestor element. Every tg2 component inside uses that theme, with no [theme] input needed.

// Toggle dark mode on the whole page
document.documentElement.setAttribute('data-tg-theme', 'tg2-dark');

// Reset to light mode
document.documentElement.removeAttribute('data-tg-theme');

// Or scope to a container element
containerElement.setAttribute('data-tg-theme', 'tg2-dark');

Components

Theme support by component
Component[theme] inputThemes
ButtonYesAll four
InputYesAll four
TableNo: set data-tg-theme on an ancestortg2-light, tg2-dark
Proudly made by © 2026 Trade Me Limited