@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.
Installation
Section titled “Installation”-
Install the package alongside Tailwind:
Terminal window pnpm add --save-dev tailwindcss @viamrobotics/tailwind-configTerminal window npm install --save-dev tailwindcss @viamrobotics/tailwind-configTerminal window yarn add --dev tailwindcss @viamrobotics/tailwind-config -
Import it from your app’s main CSS:
@import '@viamrobotics/tailwind-config'; -
(Optional) Load the variable fonts by adding a side-effect import in your app’s entry point:
import '@viamrobotics/tailwind-config/fonts'; -
(Optional) Enable the dark theme by importing it after the base config:
@import '@viamrobotics/tailwind-config';@import '@viamrobotics/tailwind-config/dark';
What it ships
Section titled “What it ships”tailwind-config.css— the@theme {}block: colors, spacing, fonts, shadows, z-index tokens.tailwind-config-dark.css(./dark) — optional dark theme. Followsprefers-color-schemeby default; a.light/.darkancestor forces the mode (class wins).fonts.js— threeimport '@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.
Token gallery
Section titled “Token gallery”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
whitegray-0gray-1gray-2gray-3gray-4gray-5gray-6gray-7gray-8gray-9blackDanger
danger-lightdanger-medium-lightdanger-mediumdanger-brightdanger-darkSuccess
success-lightsuccess-medium-lightsuccess-mediumsuccess-brightsuccess-darkInfo
info-lightinfo-medium-lightinfo-mediuminfo-brightinfo-darkWarning
warning-lightwarning-medium-lightwarning-mediumwarning-brightwarning-darkwarning-textPending
pending-lightpending-medium-lightpending-mediumpending-brightpending-darkDisabled
disabled-lightdisabled-darkGhost
ghost-lightghost-mediumBrand
power-wire-lightpower-wire-medium-lightpower-wire-mediumpower-wire-brightpower-wire-darkpcb-lightpcb-medium-lightpcb-mediumpcb-brightpcb-darkpower-button-lightpower-button-medium-lightpower-button-mediumpower-button-brightpower-button-darksolar-power-lightsolar-power-medium-lightsolar-power-mediumsolar-power-brightsolar-power-darkmars-rover-lightmars-rover-medium-lightmars-rover-mediummars-rover-brightmars-rover-darkraspberry-lightraspberry-medium-lightraspberry-mediumraspberry-brightraspberry-darkhologram-lighthologram-medium-lighthologram-mediumhologram-brighthologram-darkyoshimi-lightyoshimi-medium-lightyoshimi-mediumyoshimi-brightyoshimi-darkcyberpunk-lightcyberpunk-medium-lightcyberpunk-mediumcyberpunk-brightcyberpunk-darkhyperlink-lighthyperlink-medium-lighthyperlink-mediumhyperlink-brighthyperlink-darkIllustration pixels
pixel-redpixel-greenpixel-tealpixel-blueChart colors
chart-series-1chart-series-2chart-series-3chart-series-4chart-series-5chart-series-6chart-series-7chart-gridchart-axischart-axis-labelSurfaces
bg-extralightbg-lightbg-mediumbg-darkBorders
border-lightborder-mediumborder-darkText 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
text-link: 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-groteskSpace Grotesk: Pretty Rad Interactive Modular Elements 0123456789
font-roboto-monoRoboto Mono: Pretty Rad Interactive Modular Elements 0123456789
font-public-sansPublic Sans: Pretty Rad Interactive Modular Elements 0123456789
Text sizes
text-xsThe quick brown foxtext-smThe quick brown foxtext-baseThe quick brown foxtext-lgThe quick brown foxtext-xlThe quick brown foxtext-2xlThe quick brown foxtext-3xlThe quick brown foxtext-4xlThe quick brown foxtext-5xlThe quick brown foxtext-displayDisplay 24/26 Space Grotesk 500text-codeRoboto Mono at text-xsDark theme scoping
Section titled “Dark theme scoping”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.darkancestor and never inside a.lightsubtree.- One level of
.lightinside.darkis supported. A.darknested inside that.lightflips the tokens but notdark:utilities. - The dark palette is derived from the light tokens, and the grayscale ramp is inverted, so
bg-whiteis not literally white in dark mode.
Tokens inside this box
dark: is inactiveactive
Code
<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>