Get started

Theming

A preset is data: a style, a primary palette and a surface palette. provideTectra() turns it into CSS variables — change one value and every component repaints, on the server and in the browser.

Build a preset

Everything here repaints this whole site and is remembered — the same picker sits behind the palette button in the header.

Style
TectraSoftEdgePaper

The default: crisp borders, medium radius, quiet shadows.

Primary
Surface
Mode
LightDark
Ripple
Alex Morganalex@example.com
Pro
ProfileBillingTeam
Storage64 of 100 GB
PaidTrialDue soonOverdue
Every part of this card follows the preset.
app.config.ts
import { provideTectra } from '@tectra-ng/core/config';
import { Tectra } from '@tectra-ng/themes';

export const appConfig: ApplicationConfig = {
  providers: [
    provideTectra({
      preset: Tectra,
      ripple: true,
    }),
  ],
};

Four layers

Each layer is built from the one before it. Override at the layer you need — the rest keeps working.

  1. 1PrimitivesRaw scales with no meaning: accent and surface palettes, radius, type, motion, layers.--tx-primary-500@tectra-ng/tokens
  2. 2SemanticWhat a colour is for, in light and in dark: the primary action, a card, a field border.--tx-primary-baselight / dark
  3. 3ComponentEvery value of every component — size, padding, colour per severity and variant.--tx-button-border-radiuspreset.components
  4. 4InstanceThe dt input of one element overrides its component tokens, nothing else changes.[dt]template

Palettes

The scales of the current preset. Click a step to copy its variable.

Primary · blue
Surface · ink

Semantic tokens

68 variables of the current preset, light and dark side by side. Click a row to copy var(…).

Primary
Secondary
Success
Info
Warn
Danger
Help
Contrast
Surface
Text
Field
Highlight
List
Mask
Focus ring
Shadow

Customize

Your brand colour

Change a few semantic tokens and keep the rest of the preset.

app.config.ts
const Brand = definePreset(Tectra, {
  light: { primary: { base: '#0f766e', hover: '#115e59' } },
  dark: { primary: { base: '#2dd4bf', hover: '#5eead4' } },
});

provideTectra({ preset: Brand });
One component, everywhere

Component tokens in the preset restyle every instance of it.

app.config.ts
const Rounded = definePreset(Tectra, {
  components: {
    button: { root: { borderRadius: '999px' } },
    card: { root: { borderRadius: '24px' } },
  },
});
One element

The dt input of a single component — its tokens, scoped to it.

template.html
<button txButton [dt]="{ root: { borderRadius: '0' } }">Square</button>

<tx-badge value="New" [dt]="{ primary: { background: '#0d9488' } }" />
Switch at runtime

Swap the preset or the mode while the app runs; every component follows.

theme.ts
const theme = inject(TxThemeService);

theme.applyPreset(createTectraPreset({ style: 'soft', primary: 'violet' }));
theme.setMode('dark');
theme.toggleMode();
Plain CSS

presetToCss writes the variables of light and dark for any page, even without Angular.

build-theme.ts
import { createTectraPreset, presetToCss } from '@tectra-ng/themes';

const css = presetToCss(createTectraPreset({ primary: 'emerald' }));

writeFileSync('theme.css', css);
Your own CSS

Drop the tectra look and keep behaviour and ARIA; add classes per part.

app.config.ts
provideTectra({
  preset: Tectra,
  unstyled: true,
  pt: { button: { root: { class: 'btn' } } },
});

Next steps