HomeGetting StartedColor SystemTypographySpacingIconographyLayoutInstallationUsageAngularBlazorReactSvelteVueThemingTypographyCustomizationCSS-Only ComponentsFormsIconsIllustrationsAccessibilityGlobal ConfigurationTailwind CSSSass LibraryForge MCP ServerDropdown OptionsFocus Indicator ClippingAll componentsButtonButton AreaChipFloating Action ButtonIcon ButtonSplit ButtonAutocompleteButton ToggleCalendarCheckboxChip FieldColor PickerDate PickerDate Range PickerFile PickerLabelRadioSelectSliderSwitchText FieldTime PickerApp BarApp LauncherDrawerMenuPaginatorSkip LinkStepperTabsView SwitcherAccordionApp LayoutCardDividerExpansion PanelScaffoldSplit ViewStackStructured CardToolbarBadgeBannerBusy IndicatorCircular ProgressDialogInline MessageLinear ProgressPage StateSkeletonToastTooltipAvatarIconKeyLabel ValueListMeterSecretTableTimelineTimestampTreeKeyboard ShortcutPopoverIntroductionColorTypographySpacingShapeBorderElevationLayeringAnimationUsageIcon LibraryBlocksRoadmapChangelogBlog

Tailwind CSS

An optional Tailwind CSS v4 theme that maps Tailwind utilities to Forge design tokens.

Forge provides an optional Tailwind CSS v4 theme package that maps Tailwind utilities to Forge design tokens. This allows you to use familiar Tailwind syntax while maintaining consistency with Forge’s design system.

This package is entirely optional. Forge components work without Tailwind, and you can use Forge’s design tokens directly via CSS custom properties if you prefer.

Installation

npm install @tylertech/forge-tailwind

Setup

Import Forge CSS, Tailwind, and the Forge theme in your main CSS file using CSS layers for proper cascade control. The Forge stylesheets go at the top, before the Tailwind layer imports:

/* Forge CSS provides the design tokens the Tailwind theme references */
@import "@tylertech/forge/dist/forge-core.css";
@import "@tylertech/forge/dist/forge.css";

/* Step 1: Define your Tailwind layers */
@layer theme, base, components, utilities;

/* Step 2: Import the theme (variables) and utilities, skipping preflight */
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/utilities.css" layer(utilities);

/* Step 3: Import the Forge Tailwind theme */
@import "@tylertech/forge-tailwind";

Important: Forge CSS must be loaded in your application for the design tokens to be available. The Tailwind theme references Forge’s CSS custom properties.

Tailwind’s preflight (tailwindcss/preflight.css) is skipped on purpose: its global resets fight Forge component styles.

Dark mode

Forge’s theme toggle sets data-forge-theme="dark" on <html>. To make Tailwind’s dark: variant follow it instead of the OS-level prefers-color-scheme, add a custom variant to your entry CSS after the imports:

@custom-variant dark (&:where(html[data-forge-theme='dark'] *));

Angular Setup

If you’re using Angular, follow these additional steps to configure Tailwind CSS in your project.

1. Install Tailwind and PostCSS

Install Tailwind CSS and the PostCSS plugin:

npm install tailwindcss @tailwindcss/postcss postcss --force

2. Configure PostCSS

Create a .postcssrc.json file in the root of your Angular project:

{
  "plugins": {
    "@tailwindcss/postcss": {}
  }
}

3. Import Tailwind and Forge Theme

Add the imports to your global stylesheet (typically src/styles.css or src/styles.scss):

@import "@tylertech/forge/dist/forge-core.css";
@import "@tylertech/forge/dist/forge.css";

/* Step 1: Define your Tailwind layers */
@layer theme, base, components, utilities;

/* Step 2: Import the theme (variables) and utilities, skipping preflight */
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/utilities.css" layer(utilities);

/* Step 3: Import the Forge Tailwind theme */
@import "@tylertech/forge-tailwind";

4. Start Your Application

Run your development server:

ng serve

5. Start Using Tailwind

You can now use Tailwind utilities alongside Forge components in your templates:

<div class="flex gap-4 p-6">
  <forge-card>
    <h2 class="text-heading4">Card Title</h2>
    <p class="text-body2">Content styled with Tailwind and Forge</p>
  </forge-card>
</div>

For more information on using Forge with Angular, see the Angular Framework Guide.

We highly recommend using Tailwind primarily for layout purposes. Tailwind excels at:

  • Layout — flex, grid, block, inline-flex
  • Spacing — p-*, m-*, gap-*
  • Sizing — w-*, h-*, max-w-*, min-h-*
  • Positioning — absolute, relative, fixed, top-*, left-*
  • Responsive design — sm:, md:, lg: breakpoint prefixes

For colors, typography, and component styling, prefer using Forge components and CSS custom properties directly. This ensures visual consistency with the design system and makes theming seamless.

<!-- Recommended: Tailwind for layout, Forge for styling -->
<div class="flex gap-4 p-6">
  <forge-card>
    <p class="text-body2">Content styled by Forge</p>
  </forge-card>
</div>

The color and typography utilities in this package are available for edge cases, but layout utilities should be your primary use of Tailwind with Forge.

What’s Included

Theme Variables

The package extends Tailwind’s theme with Forge design tokens:

CategoryTailwind UtilitiesExample
Spacing

p-*, m-*, gap-*

p-4, p-medium, gap-large

Border Radiusrounded-*

rounded-sm, rounded-lg, rounded-full

Box Shadowshadow-*

shadow-sm, shadow-lg, shadow-8

Z-Indexz-*

z-surface, z-dialog, z-tooltip

Border Widthborder-*

border-thin, border-medium

Durationduration-*

duration-short-1, duration-medium-2

Easingease-*

ease-standard, ease-emphasized

Utility Classes

The package also ships pre-built classes for common Forge layout patterns:

ClassDescription
grid-min-320

Responsive auto-fill grid for card layouts. Columns use minmax(min(320px, 100%), 1fr), so each targets ~320px and shrinks to fit narrow containers, with a gap-medium gap.

<div class="grid-min-320">
  <forge-card>...</forge-card>
  <forge-card>...</forge-card>
  <forge-card>...</forge-card>
</div>

Background Colors

Use bg-* utilities for Forge surface and semantic background colors.

Surface

ColorClassDescription
bg-surfaceDefault surface background
bg-surface-dimDimmed surface
bg-surface-brightBright surface
bg-surface-inverseInverse surface
bg-surface-container-minimumMinimum container
bg-surface-container-lowLow container
bg-surface-containerDefault container
bg-surface-container-mediumMedium container
bg-surface-container-highHigh container

Brand

ColorClassDescription
bg-brandBrand color

Primary

ColorClassDescription
bg-primaryPrimary color
bg-primary-container-minimumMinimum primary container
bg-primary-container-lowLow primary container
bg-primary-containerDefault primary container
bg-primary-container-highHigh primary container

Secondary

ColorClassDescription
bg-secondarySecondary color
bg-secondary-container-minimumMinimum secondary container
bg-secondary-container-lowLow secondary container
bg-secondary-containerDefault secondary container
bg-secondary-container-highHigh secondary container

Tertiary

ColorClassDescription
bg-tertiaryTertiary color
bg-tertiary-container-minimumMinimum tertiary container
bg-tertiary-container-lowLow tertiary container
bg-tertiary-containerDefault tertiary container
bg-tertiary-container-highHigh tertiary container

Success

ColorClassDescription
bg-successSuccess color
bg-success-container-minimumMinimum success container
bg-success-container-lowLow success container
bg-success-containerDefault success container
bg-success-container-highHigh success container

Error

ColorClassDescription
bg-errorError color
bg-error-container-minimumMinimum error container
bg-error-container-lowLow error container
bg-error-containerDefault error container
bg-error-container-highHigh error container

Warning

ColorClassDescription
bg-warningWarning color
bg-warning-container-minimumMinimum warning container
bg-warning-container-lowLow warning container
bg-warning-containerDefault warning container
bg-warning-container-highHigh warning container

Info

ColorClassDescription
bg-infoInfo color
bg-info-container-minimumMinimum info container
bg-info-container-lowLow info container
bg-info-containerDefault info container
bg-info-container-highHigh info container

Text Colors

Use text-* utilities for text emphasis levels and semantic colors.

Emphasis Levels

ColorClassDescription
Aatext-highHigh emphasis text

Aa

text-high-inverseHigh emphasis inverse
Aatext-mediumMedium emphasis text

Aa

text-medium-inverseMedium emphasis inverse
Aatext-lowLow emphasis text

Aa

text-low-inverseLow emphasis inverse
Aatext-lowestLowest emphasis text

Aa

text-lowest-inverseLowest emphasis inverse

Semantic

ColorClassDescription
Aatext-brandBrand color
Aatext-primaryPrimary color
Aatext-secondarySecondary color
Aatext-tertiaryTertiary color
Aatext-successSuccess color
Aatext-errorError color
Aatext-warningWarning color
Aatext-infoInfo color
<p class="text-high">High emphasis text</p>
<p class="text-medium">Medium emphasis text</p>
<p class="text-primary">Primary colored text</p>

Border Colors

Use border-* utilities for outline and semantic border colors.

border-outline
border-outline-high
border-primary
border-error
border-success
<div class="border border-outline">...</div>
<div class="border border-primary">...</div>

Typography

Apply complete Forge typography styles with single utility classes.

Display

ClassDescription
text-display1
Display 1 (smallest)
text-display2
Display 2
text-display3
Display 3
text-display4
Display 4
text-display5
Display 5
text-display6
Display 6
text-display7
Display 7
text-display8
Display 8 (largest display)

Heading

ClassDescription
text-heading1
Heading 1 (smallest)
text-heading2
Heading 2
text-heading3
Heading 3
text-heading4
Heading 4
text-heading5
Heading 5
text-heading6
Heading 6
text-heading7
Heading 7
text-heading8
Heading 8 (largest heading)

Subheading

ClassDescription
text-subheading1
Subheading 1 (smallest)
text-subheading2
Subheading 2
text-subheading3
Subheading 3
text-subheading4
Subheading 4
text-subheading5
Subheading 5
text-subheading6
Subheading 6
text-subheading7
Subheading 7
text-subheading8
Subheading 8 (largest subheading)

Body

ClassDescription
text-body1
Body 1 (smallest)
text-body2
Body 2
text-body3
Body 3
text-body4
Body 4 (largest body)

Label

ClassDescription
text-label1
Label 1 (smallest)
text-label2
Label 2
text-label3
Label 3 (largest label)

Other

ClassDescription
text-button
Button text
text-overline
Overline text
Link text
<h1 class="text-heading4">Page Title</h1>
<p class="text-body2">Body content</p>
<span class="text-label1">Small label</span>

Elevation (Box Shadow)

Use Tailwind aliases or Forge’s numeric elevation scale (0-24).

shadow-sm
shadow-md
shadow-lg
shadow-xl
shadow-2xl
<!-- Tailwind aliases -->
<div class="shadow-sm">...</div>
<div class="shadow-lg">...</div>

<!-- Forge elevation numbers -->
<div class="shadow-4">...</div>
<div class="shadow-16">...</div>

Border Radius

Use rounded-* utilities mapped to Forge shape tokens.

rounded-xs
rounded-sm
rounded-md
rounded-lg
rounded-xl
rounded-full

Spacing

Both numeric (Tailwind-familiar) and semantic (Forge-familiar) scales are available.

p-14px — xxsmall
p-28px — xsmall
p-312px — small
p-416px — medium
p-624px — large
p-832px — xlarge
p-1248px — xxlarge
<!-- Numeric scale -->
<div class="p-4 m-8">...</div>

<!-- Semantic scale -->
<div class="p-medium m-xlarge">...</div>

When to Use

Consider using @tylertech/forge-tailwind when:

  • Your team is already familiar with Tailwind CSS
  • You want utility-first styling with Forge’s design tokens
  • You’re building custom layouts alongside Forge components

Consider using Forge’s CSS custom properties directly when:

  • You prefer minimal dependencies
  • You’re only using Forge components without custom styling
  • You want maximum control over your CSS architecture
Loading Forge chat…