Skip to content

@viamrobotics/tailwind-config

@viamrobotics/tailwind-config is Viam’s shared Tailwind CSS v4 configuration. It exposes design tokens as Tailwind v4 theme values in an @theme {} block plus an optional ./fonts entry point that side-effect imports the variable-font packages.

  1. Install the package alongside Tailwind:

    Terminal window
    pnpm add --save-dev tailwindcss @viamrobotics/tailwind-config
  2. Import it from your app’s main CSS:

    @import '@viamrobotics/tailwind-config';
  3. (Optional) Load the variable fonts by adding a side-effect import in your app’s entry point:

    import '@viamrobotics/tailwind-config/fonts';
  4. (Optional) Enable the dark theme by importing it after the base config:

    @import '@viamrobotics/tailwind-config';
    @import '@viamrobotics/tailwind-config/dark';
  • tailwind-config.css — the @theme {} block: colors, spacing, fonts, shadows, z-index tokens.
  • tailwind-config-dark.css (./dark) — optional dark theme. Follows prefers-color-scheme by default; a .light/.dark ancestor forces the mode (class wins).
  • fonts.js — three import '@fontsource-variable/*' lines for Space Grotesk, Roboto Mono, and Public Sans.

Token values match the Viam design system. Don’t invent values; copy from the published guides.

The package also ships the design system’s component classes: button, badge, input, and more, as plain Tailwind classes.

Every color, text, and font token the @theme {} block defines, rendered with the utility that reads it. The component classes have their own page.

Grayscale

white
gray-0
gray-1
gray-2
gray-3
gray-4
gray-5
gray-6
gray-7
gray-8
gray-9
black

Danger

danger-light
danger-medium-light
danger-medium
danger-bright
danger-dark

Success

success-light
success-medium-light
success-medium
success-bright
success-dark

Info

info-light
info-medium-light
info-medium
info-bright
info-dark

Warning

warning-light
warning-medium-light
warning-medium
warning-bright
warning-dark
warning-text

Pending

pending-light
pending-medium-light
pending-medium
pending-bright
pending-dark

Disabled

disabled-light
disabled-dark

Ghost

ghost-light
ghost-medium

Brand

power-wire-light
power-wire-medium-light
power-wire-medium
power-wire-bright
power-wire-dark
pcb-light
pcb-medium-light
pcb-medium
pcb-bright
pcb-dark
power-button-light
power-button-medium-light
power-button-medium
power-button-bright
power-button-dark
solar-power-light
solar-power-medium-light
solar-power-medium
solar-power-bright
solar-power-dark
mars-rover-light
mars-rover-medium-light
mars-rover-medium
mars-rover-bright
mars-rover-dark
raspberry-light
raspberry-medium-light
raspberry-medium
raspberry-bright
raspberry-dark
hologram-light
hologram-medium-light
hologram-medium
hologram-bright
hologram-dark
yoshimi-light
yoshimi-medium-light
yoshimi-medium
yoshimi-bright
yoshimi-dark
cyberpunk-light
cyberpunk-medium-light
cyberpunk-medium
cyberpunk-bright
cyberpunk-dark
hyperlink-light
hyperlink-medium-light
hyperlink-medium
hyperlink-bright
hyperlink-dark

Illustration pixels

pixel-red
pixel-green
pixel-teal
pixel-blue

Chart colors

chart-series-1
chart-series-2
chart-series-3
chart-series-4
chart-series-5
chart-series-6
chart-series-7
chart-grid
chart-axis
chart-axis-label

Surfaces

bg-extralight
bg-light
bg-medium
bg-dark

Borders

border-light
border-medium
border-dark

Text colors

text-heading: The quick brown fox jumps over the lazy dog

text-default: The quick brown fox jumps over the lazy dog

text-subtle-1: The quick brown fox jumps over the lazy dog

text-subtle-2: The quick brown fox jumps over the lazy dog

text-disabled: The quick brown fox jumps over the lazy dog

Code colors

1  {
2    "name": "prime",
3    "version": 2,
4    "stable": true,
5    "deprecated": null
6  }
1  // a machine on the network
2  class Rover {}
3  drive(3)

Font families

font-space-grotesk

Space Grotesk: Pretty Rad Interactive Modular Elements 0123456789

font-roboto-mono

Roboto Mono: Pretty Rad Interactive Modular Elements 0123456789

font-public-sans

Public Sans: Pretty Rad Interactive Modular Elements 0123456789

Text sizes

text-xsThe quick brown fox
text-smThe quick brown fox
text-baseThe quick brown fox
text-lgThe quick brown fox
text-xlThe quick brown fox
text-2xlThe quick brown fox
text-3xlThe quick brown fox
text-4xlThe quick brown fox
text-5xlThe quick brown fox
text-displayDisplay 24/26 Space Grotesk 500
text-codeRoboto Mono at text-xs

The optional dark theme reassigns the --color-* tokens under a .dark ancestor, so utilities adapt with no markup changes. A .light ancestor forces light mode, and the class wins over prefers-color-scheme. The button flips the dark class on the box itself, not on the page.

  • dark: utilities follow the same rules as the tokens. They apply under a .dark ancestor and never inside a .light subtree.
  • One level of .light inside .dark is supported. A .dark nested inside that .light flips the tokens but not dark: utilities.
  • The dark palette is derived from the light tokens, and the grayscale ramp is inverted, so bg-white is not literally white in dark mode.

Tokens inside this box

dark: is inactive

bg-extralight
bg-light
bg-medium
Success tokens
Danger tokens
Code
ThemeToggleDemo.svelte
<script lang="ts">
let isDark = $state(false);
</script>
<div
class={[
"border-light bg-white text-default flex flex-col gap-3 rounded-sm border p-4",
{ dark: isDark },
]}
>
<button
type="button"
class="button self-start"
aria-pressed={isDark}
onclick={() => (isDark = !isDark)}
>
Dark mode
</button>
<p class="text-heading font-medium">Tokens inside this box</p>
<p class="text-subtle-1 text-sm">
<code class="text-code">dark:</code> is
<span class="dark:hidden">inactive</span><span class="hidden dark:inline">active</span>
</p>
<div class="grid grid-cols-3 gap-2 text-sm">
<div class="bg-extralight border-light rounded-sm border p-3">bg-extralight</div>
<div class="bg-light border-light rounded-sm border p-3">bg-light</div>
<div class="bg-medium border-light rounded-sm border p-3">bg-medium</div>
</div>
<div class="bg-success-light text-success-dark border-success-medium rounded-sm border p-3 text-sm">
Success tokens
</div>
<div class="bg-danger-light text-danger-dark border-danger-medium rounded-sm border p-3 text-sm">
Danger tokens
</div>
</div>