Skip to content

Tailwind Utilities

Velocity extends Tailwind CSS with semantic utility classes mapped to design tokens.

ClassTokenPurpose
bg-background--backgroundPrimary page background
bg-background-secondary--background-secondarySecondary/card backgrounds
bg-primary--primaryPrimary action backgrounds
bg-secondary--secondarySecondary action backgrounds
bg-surface-invert--surface-invertInverted dark sections
ClassTokenPurpose
text-foreground--foregroundPrimary text
text-foreground-secondary--foreground-secondarySecondary text
text-foreground-muted--foreground-mutedSubtle/hint text
text-primary-foreground--primary-foregroundText on primary backgrounds
text-on-invert--on-invertText on inverted backgrounds
ClassTokenPurpose
border-border--borderStandard borders
border-border-strong--border-strongEmphasized borders
border-invert--border-invertBorders on dark sections
ClassUsage
bg-successSuccess state background
bg-success-lightLight success background
text-success-foregroundSuccess text
ClassUsage
bg-warningWarning state background
bg-warning-lightLight warning background
text-warning-foregroundWarning text
ClassUsage
bg-errorError state background
bg-error-lightLight error background
text-error-foregroundError text
ClassUsage
bg-infoInfo state background
bg-info-lightLight info background
text-info-foregroundInfo text
<div class="bg-background-secondary border border-border rounded-lg p-4">
<h3 class="text-foreground">Card Title</h3>
<p class="text-foreground-muted">Card description text</p>
</div>
<section class="bg-surface-invert py-16">
<div class="container">
<h2 class="text-on-invert">Section Title</h2>
<p class="text-on-invert-secondary">Section content</p>
</div>
</section>
<div class="bg-success-light text-success-foreground p-4 rounded-lg">
<p>Your changes have been saved successfully.</p>
</div>
<button class="bg-primary text-primary-foreground px-4 py-2 rounded-lg">
Submit
</button>

All semantic utilities automatically adapt to dark mode when the .dark class is present on <html>:

<!-- These classes work in both light and dark mode -->
<div class="bg-background text-foreground">
Content adapts automatically
</div>