Keyboard shortcut: Ctrl + K
Get started

Theming

Select a light or dark theme with data-theme. Customise component styles by overriding the --vectis-* CSS variables.

Switch themes

Set data-theme="dark" on <html> for the dark theme. Use data-theme="light" for the light theme, which is also the default.

html
<!-- No attribute at all is the light theme -->
<html>

<!-- The same page, dark -->
<html data-theme="dark">

Light

Live

Dark

Live

Set data-theme on a container to theme one section. Nested containers can use a different theme.

html
<!-- Use a dark theme for the aside. -->
<main data-theme="light">
  <VDataTable :columns="columns" :rows="rows" title="Projects" />

  <aside data-theme="dark">
    <VButton tone="accent">Deploy</VButton>
  </aside>
</main>

Each theme also sets color-scheme, which adapts native form controls and scrollbars. The stylesheet paints body with the theme surface and text colours.

Set data-theme="system" to follow the prefers-color-scheme preference. It applies from the first paint, follows preference changes and needs no script. Dark-theme overrides written for [data-theme="dark"] must also target [data-theme="system"] inside a @media (prefers-color-scheme: dark) rule.

html
<!-- Light or dark, following the system preference -->
<html data-theme="system">

Customise colours and tokens

Design tokens are exposed as CSS variables at two levels:

  • Primitives: Colour palettes and scales for spacing, typography, radii, shadows and motion.
  • Semantic roles: Variables named by purpose, such as --vectis-color-surface or --vectis-color-accent. Use these to customise components.

Changing a semantic token updates the components that use it. The focus colour has its own token, --vectis-focus-ring-color. Check both text and focus contrast when changing your palette.

Override tokens on :root for the whole page, on a class for a section, or on [data-theme="dark"] for dark-theme values.

css
/* Scope overrides to this container. */
.coral {
  --vectis-color-accent: oklch(64% 0.16 32);
  --vectis-color-accent-hover: oklch(58% 0.16 32);
  --vectis-color-accent-active: oklch(52% 0.15 32);
  --vectis-color-accent-text: oklch(48% 0.15 32);
  /* Mixed towards the surface, so both tints follow whichever theme is showing. */
  --vectis-color-accent-surface: color-mix(in oklch, var(--vectis-color-accent) 14%, var(--vectis-color-surface));
  --vectis-color-accent-border: color-mix(in oklch, var(--vectis-color-accent) 40%, var(--vectis-color-surface));
  /* Set the focus colour separately from the accent. */
  --vectis-focus-ring-color: oklch(58% 0.16 32);
  --vectis-radius-interactive: var(--vectis-radius-pill);
}

/* Use a lighter accent text colour in the dark theme. */
[data-theme='dark'] .coral {
  --vectis-color-accent-text: oklch(78% 0.13 32);
}
Beta

This panel overrides the accent colours, focus colour and corner radii. Accent text has a separate value in the dark theme.

The built-in palettes use OKLCH. You can use other CSS colour formats for overrides. Check the resulting hover, pressed and tinted states, including those derived with color-mix().

Five palettes are included: gray, indigo, red, green and amber. To use a different palette, assign your colours to the semantic tokens.

Token descriptions and default values for both themes are listed in Design tokens.

Density

Controls follow a standard scale of 24, 32, 40, 48 and 56px. Set --vectis-density-delta to var(--vectis-space-1) to switch to the compact scale of 20, 28, 36, 44 and 52px: every control loses 4px of height and components such as tabs, accordions and tables lose 4px of padding. Set it on :root for the whole interface, or on a container for one region, so that elements of both scales never sit side by side.

css
/* Every control and component padding, across the page. */
:root {
  --vectis-density-delta: var(--vectis-space-1);
}

/* Or a single region, such as a dense toolbar. */
.toolbar {
  --vectis-density-delta: var(--vectis-space-1);
}
Beta

This panel sets the compact density on its container.

CSS layers

The library declares four layers, in order: vectis.reset, vectis.tokens, vectis.components and vectis.utilities. Write overrides outside these layers to take precedence over the library’s normal declarations.

css
/* The order the library declares, for reference. */
@layer vectis.reset, vectis.tokens, vectis.components, vectis.utilities;

/* Unlayered CSS overrides the library's normal declarations. */
.v-button {
  text-transform: uppercase;
}

If your application uses layers, declare its override layer after the library’s layers. Avoid adding overrides to vectis.components, where selector specificity and source order still determine priority.

CSS build targets

Set your CSS build targets to the library’s supported browser versions. Older targets can cause the bundler to rewrite features such as :dir() and OKLCH colours.

For example, converting :dir(rtl) to language selectors breaks direction-based styles on a page with dir="rtl" and lang="en". Check the production build as well as the development server.

Set build.cssTarget in Vite, or vite.build.cssTarget in Nuxt:

ts
// vite.config.ts: the browsers Vectis UI is written for
export default defineConfig({
  build: { cssTarget: ['chrome134', 'edge134', 'safari26', 'firefox147'] },
})

// nuxt.config.ts: the same value, one level down
export default defineNuxtConfig({
  vite: { build: { cssTarget: ['chrome134', 'edge134', 'safari26', 'firefox147'] } },
})