@frontiers/tailwind-plugin

中文文档
1.2.2发布于 2026/06/22ISCES Module零依赖近 30 天下载 8259

Tailwind CSS 4 plugin that extends tailwindcss-primeui with custom utilities for PrimeVue components and @frontiers/prime-preset theme

原始使用文档
文档目录39 节
  1. Overview
  2. Purpose
  3. Installation
  4. Usage
  5. Full Import (Theme + Typography)
  6. Modular Imports
  7. Features
  8. ✍️ Typography Utilities
  9. 🎨 PrimeVue Color Integration
  10. 🔤 Custom Font
  11. 📐 Responsive Breakpoints
  12. 🎭 Elevation Utilities
  13. Examples
  14. Using Typography Utilities
  15. Using Elevation Utilities
  16. Using PrimeVue Colors
  17. Using with PrimeVue Components
  18. Responsive Design with Custom Breakpoints
  19. Dark Mode Support
  20. How It Works
  21. Usage Tips & Best Practices
  22. Typography
  23. Colors
  24. Elevation
  25. From Figma (design-to-code)
  26. Maintaining the agent catalog
  27. Requirements
  28. Color Reference
  29. Font Family
  30. Framework Integration
  31. Vue 3 / Nuxt
  32. React / Next.js
  33. Vite
  34. Benefits
  35. Troubleshooting
  36. Colors not showing up?
  37. Different colors than expected?
  38. License
  39. Author

@frontiers/tailwind-plugin

A Tailwind CSS 4 plugin that extends tailwindcss-primeui with custom utilities and seamlessly integrates PrimeVue design tokens with Tailwind's utility class system.

Overview

This plugin extends tailwindcss-primeui and is designed to work with PrimeVue components and the @frontiers/prime-preset theme. It bridges PrimeVue's color system with Tailwind CSS 4, allowing you to use PrimeVue's theme colors directly in Tailwind utility classes. It maps all PrimeVue color palettes (green, red, gray, purple, cyan, orange, blue) to Tailwind's color system, provides custom typography and elevation utilities, and sets Museo Sans as the default sans-serif font.

Purpose

  • Extends tailwindcss-primeui - Builds upon the PrimeUI Tailwind plugin with additional utilities
  • PrimeVue Integration - Designed specifically for use with PrimeVue components
  • Frontiers Theme - Works seamlessly with @frontiers/prime-preset theme for PrimeVue
  • Brink Design System Utilities - Adds 72 typography and 50 elevation utilities from Brink Design System, adapted as Tailwind 4 utilities

🤖 Using an AI agent / LLM? A complete, auto-generated inventory of every utility in this package (all typography, elevation, color, and breakpoint tokens) lives in AGENTS.md. It ships inside the published package, so consumers can always read it at node_modules/@frontiers/tailwind-plugin/AGENTS.md. It also includes a From Figma section that maps Figma style names 1:1 to utilities for design-to-code via the Figma MCP.

Installation

Install the plugin along with its peer dependencies:

# Install all required dependencies
pnpm add @frontiers/tailwind-plugin tailwindcss-primeui @primeuix/themes

# Install PrimeVue and the Frontiers theme preset
pnpm add primevue @frontiers/prime-preset

Note: This plugin extends tailwindcss-primeui and is designed to work with PrimeVue components using the @frontiers/prime-preset theme.

Usage

Full Import (Theme + Typography)

Import everything in your main CSS file:

@import "tailwindcss";
@import "@frontiers/tailwind-plugin";

This imports theme (colors & fonts), typography utilities, and elevation shadows.

Modular Imports

Import only what you need:

@import "tailwindcss";

/* Theme only (PrimeVue colors + Museo Sans font) */
@import "@frontiers/tailwind-plugin/theme";

/* Typography only (72 utility classes) */
@import "@frontiers/tailwind-plugin/typography";

/* Elevation only (50 shadow utilities) */
@import "@frontiers/tailwind-plugin/elevation";

/* Or import selectively */
@import "@frontiers/tailwind-plugin/theme";
@import "@frontiers/tailwind-plugin/typography";
@import "@frontiers/tailwind-plugin/elevation";

Features

✍️ Typography Utilities

Custom typography utilities based on the Brink Design System, adapted as Tailwind 4 utilities for consistent text styling:

  • Headings (f-heading-*) - 6 sizes (xs-2xl) with 3 weights each (light, semibold, bold)
  • Display (f-display-*) - 6 sizes (xs-2xl) with 2 weights (light, semibold)
  • Body (f-body-*) - 4 sizes (sm-xl) with regular and tall line heights
  • Labels (f-label-*) - 4 sizes (xs-lg) with 2 weights
  • Buttons (f-button-*) - 3 sizes (sm-lg), bold (700)
  • Links (f-link-*) - 2 sizes (sm, md), bold (700); also available as plural aliases f-links-* for Figma token-name parity
  • Quotes (f-quote-*) - 2 sizes (sm, lg)
  • Fluid Headings (f-fluid-heading-*) - Responsive typography that scales with viewport

Total: 72 typography utility classes (from Brink Design System; includes 2 plural f-links-* aliases)

🎨 PrimeVue Color Integration

All PrimeVue color palettes are mapped to Tailwind:

  • Green (green-50 through green-950)
  • Red (red-50 through red-950)
  • Gray (gray-50 through gray-950)
  • Purple (purple-50 through purple-950)
  • Cyan (cyan-50 through cyan-950)
  • Orange (orange-50 through orange-950)
  • Blue (blue-50 through blue-950)

🔤 Custom Font

Sets Museo Sans as the default sans-serif font family.

📐 Responsive Breakpoints

Custom breakpoints aligned with the Brink Design System:

BreakpointSizePixelsUse Case
sm40rem640pxMobile landscape
md48rem768pxTablets
lg64rem1024pxSmall laptops
xl80rem1280pxDesktops
2xl90rem1440pxLarge desktops
3xl120rem1920pxExtra large screens / 1080p

🎭 Elevation Utilities

Custom shadow utilities based on the Brink Design System, adapted as Tailwind 4 utilities for depth and elevation effects:

  • Light Shadows (elevation-light-*) - Subtle shadows for light themes
  • Dark Shadows (elevation-dark-*) - Pronounced shadows for emphasis

Positions: top, center, bottom, right, left
Intensities: 10, 20, 30, 40, 50 (increasing depth)

Total: 50 elevation utility classes (from Brink Design System)

Example class names:

  • elevation-light-bottom-20 - Light shadow below element
  • elevation-dark-center-30 - Dark shadow around element
  • elevation-light-top-10 - Subtle light shadow above element

Examples

Using Typography Utilities

<!-- Headings -->
<h1 class="f-heading-2xl-bold">Main Heading</h1>
<h2 class="f-heading-xl-semibold">Section Heading</h2>
<h3 class="f-heading-lg">Subsection</h3>

<!-- Display Text (Hero sections) -->
<h1 class="f-display-xl-semibold">Large Hero Title</h1>
<p class="f-display-xs">Impressive subtitle</p>

<!-- Body Text -->
<p class="f-body-lg">Large body text for readability</p>
<p class="f-body-md-tall">Regular body with comfortable line height</p>
<p class="f-body-sm">Small descriptive text</p>

<!-- Labels -->
<label class="f-label-md-semibold">Form Label</label>
<span class="f-label-sm">Helper text</span>

<!-- Buttons -->
<button class="f-button-lg bg-blue-500 text-white px-6 py-3">
  Large Button
</button>

<!-- Links -->
<a href="#" class="f-link-md text-blue-600">Medium Link</a>

<!-- Fluid Typography (Responsive) -->
<h1 class="f-fluid-heading-2xl">
  Scales from 1.5rem on mobile to 2.5rem on large screens
</h1>

Using Elevation Utilities

<!-- Light Shadows (for light backgrounds) -->
<div class="bg-white elevation-light-bottom-20 rounded-lg p-6">
  Card with subtle bottom shadow
</div>

<!-- Dark Shadows (for emphasis) -->
<div class="bg-white elevation-dark-center-30 rounded-lg p-6">
  Card with pronounced shadow
</div>

<!-- Directional Shadows -->
<div class="bg-white elevation-light-right-20 rounded-lg p-6">
  Shadow on the right side
</div>

<div class="bg-white elevation-light-top-10 rounded-lg p-6">
  Subtle shadow above (inverted)
</div>

<!-- Different Intensities -->
<div class="bg-white elevation-light-bottom-10 rounded-lg p-4">Light</div>
<div class="bg-white elevation-light-bottom-30 rounded-lg p-4">Medium</div>
<div class="bg-white elevation-light-bottom-50 rounded-lg p-4">Heavy</div>

Using PrimeVue Colors

<!-- Background colors -->
<div class="bg-green-500 text-white">Success message</div>
<div class="bg-red-500 text-white">Error message</div>
<div class="bg-blue-500 text-white">Info message</div>

<!-- Text colors -->
<p class="text-purple-600">Purple text</p>
<p class="text-cyan-500">Cyan text</p>
<p class="text-orange-700">Orange text</p>

<!-- Border colors -->
<div class="border border-gray-300">Bordered content</div>
<div class="border-2 border-green-500">Green border</div>

<!-- Hover states -->
<button class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2">
  Hover me
</button>

Using with PrimeVue Components

This plugin is designed to work seamlessly with PrimeVue components and the @frontiers/prime-preset theme:

<template>
  <div class="p-6">
    <!-- PrimeVue components styled with custom typography -->
    <h1 class="f-heading-2xl-bold mb-6">Dashboard</h1>

    <!-- PrimeVue Button with Tailwind utilities -->
    <Button label="Primary" class="mr-2" />

    <!-- PrimeVue Card with elevation utilities -->
    <Card class="elevation-light-bottom-20">
      <template #title>
        <h2 class="f-heading-lg-semibold text-gray-900">Card Title</h2>
      </template>
      <template #content>
        <p class="f-body-md text-gray-600">
          Using PrimeVue components with @frontiers/prime-preset theme and
          custom Tailwind utilities from this plugin!
        </p>
      </template>
    </Card>
  </div>
</template>

<script setup>
// Using @frontiers/prime-preset theme
import { usePrimeVue } from "primevue/config"
import FrontiersPreset from "@frontiers/prime-preset"

const PrimeVue = usePrimeVue()
PrimeVue.config.theme = {
  preset: FrontiersPreset,
}
</script>

Responsive Design with Custom Breakpoints

Use the custom breakpoints for responsive layouts:

<!-- Color changes at each breakpoint -->
<div
  class="bg-blue-500 md:bg-green-500 lg:bg-purple-500 xl:bg-cyan-500 2xl:bg-orange-500 3xl:bg-red-500 text-white p-4">
  Colors change at different breakpoints
</div>

<!-- Responsive typography -->
<h1 class="f-heading-md sm:f-heading-lg md:f-heading-xl lg:f-heading-2xl-bold">
  Responsive heading
</h1>

<!-- Responsive grid layout -->
<div
  class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 gap-4">
  <!-- Grid items -->
</div>

<!-- Container widths -->
<div
  class="w-full lg:max-w-4xl xl:max-w-5xl 2xl:max-w-6xl 3xl:max-w-7xl mx-auto">
  Content container
</div>

Dark Mode Support

<div class="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100">
  Adapts to dark mode
</div>

How It Works

The plugin uses Tailwind CSS 4's @theme inline directive to map PrimeVue CSS custom properties to Tailwind's color system:

@theme inline {
  --color-green-500: var(--p-green-500);
  --color-red-500: var(--p-red-500);
  /* ... and so on for all colors */
}

This means:

  • ✅ Colors stay in sync with your PrimeVue theme
  • ✅ Single source of truth for colors
  • ✅ Use Tailwind utilities with PrimeVue's design system
  • ✅ No duplicate color definitions

Because the colors resolve from the live --p-* variables, switching the PrimeVue theme at runtime updates every Tailwind utility automatically — no rebuild, no duplicated palette:

import { usePrimeVue } from "primevue/config"

const PrimeVue = usePrimeVue()
// Every `bg-*` / `text-* `/ `border-*` utility using these palettes follows the new theme.
PrimeVue.changeTheme("current-theme", "new-theme", "theme-link")

Usage Tips & Best Practices

Typography

  • Reach for a single f-* class instead of stacking text-* font-* leading-*.
  • Use f-body-md / f-body-lg for most running text; use the -tall variants for long-form paragraphs.
  • Use f-fluid-heading-* when a heading should scale across breakpoints.
  • semibold for emphasis, bold for strong emphasis.

Colors

  • Prefer the semantic tokens from the preset (primary, surface) for theme-aware UI; use the named palettes (green, red, …) for fixed intents.
  • Shade guidance: 50–200 for backgrounds, 300–500 for borders, 600–900 for text.
  • Hover/active: go one shade darker on hover, two on active.
  • Never hardcode hex values (bg-[#22c55e]) when a token exists.

Elevation

  • Intensity guide: 10 hover states · 20 cards/panels · 30 dropdowns & popovers · 40 modals & dialogs · 50 maximum depth (overlays).
  • Position guide: bottom for most cards/floating elements · center for modals/centered overlays · top for inverted shadows on sticky headers · right/left for sidebars and slide-out panels.
  • Use light shadows for subtle depth, dark shadows for emphasis; pair with rounded-lg/rounded-xl.

From Figma (design-to-code)

The UX team maintains these primitives as Figma styles. When implementing a design pulled through the Figma MCP, map Figma styles to utilities instead of copying raw CSS.

  • Typography maps 1:1 — the class is the Figma style name prefixed with f-:
<!-- Figma style "heading-2xl-bold"  -->
<h1 class="f-heading-2xl-bold">…</h1>
<!-- Figma style "body-md-tall"      -->
<p class="f-body-md-tall">…</p>
<!-- Figma style "label-sm-semibold" -->
<span class="f-label-sm-semibold">…</span>
<!-- Figma style "link-md" (plural f-links-md also works) -->
<a class="f-link-md underline">…</a>
<!-- "…-underline" Figma styles = compose with Tailwind `underline` -->
  • Elevation maps 1:1 — use the matching elevation-{mode}-{position}-{intensity} class, not a raw box-shadow.
  • Colors do NOT map 1:1 — Figma uses UX palette steps (0–90) with different values, so a Figma shade number is not the same Tailwind number (Figma …/50 → …-600). Never copy a Figma hex or shade number; convert, then map by intent: brand fill → bg-primary, near-white background → bg-surface-0, body text → text-surface-900, borders → border-surface-200.

Scheme palette conversion (blue, red, orange, purple, green, cyan):

Figma0510203040505560708090
Token50100200300400500600—700800900950

See the AGENTS.md From Figma section for the full conversion tables (scheme palettes, grey/surface, and semantic tokens) and the color caveats.

💡 For the complete, always-accurate list of every f-*, elevation-*, color, and breakpoint token, see AGENTS.md.

Maintaining the agent catalog

AGENTS.md is generated from the source CSS (src/theme.css, src/typography.css, src/elevation.css) by scripts/generate-catalog.mjs, so it can never drift from the utilities the package ships. It's committed to the repo (alongside README.md / CHANGELOG.md) and ships at node_modules/@frontiers/tailwind-plugin/AGENTS.md.

Whenever you change the utilities in src/*.css, regenerate it:

# Regenerates AGENTS.md from src/*.css
pnpm build

Note: this is a CSS-only package — it publishes src/ directly (no build artifact). pnpm build only regenerates the committed AGENTS.md; commit the result alongside your CSS change.

Requirements

  • Tailwind CSS >= 4.0.0
  • @primeuix/themes >= 1.0.0 (provides the --p-* CSS variables)
  • tailwindcss-primeui >= 0.3.0 (PrimeUI Tailwind CSS plugin)

Color Reference

All colors follow the standard Tailwind scale (50-950):

PaletteClassesPrimeVue Variables
Greengreen-50 to green-950--p-green-*
Redred-50 to red-950--p-red-*
Graygray-50 to gray-950--p-gray-*
Purplepurple-50 to purple-950--p-purple-*
Cyancyan-50 to cyan-950--p-cyan-*
Orangeorange-50 to orange-950--p-orange-*
Blueblue-50 to blue-950--p-blue-*

Each palette has 11 shades: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950

Font Family

The plugin sets Museo Sans as the default sans-serif font:

<p class="font-sans">This text uses Museo Sans</p>

Font stack:

"Museo Sans", "MuseoSans", ui-sans-serif, system-ui, sans-serif, ...

Framework Integration

Vue 3 / Nuxt

<!-- app.vue or nuxt.config.ts -->
<style>
@import "tailwindcss";
@import "@frontiers/tailwind-plugin";
</style>

React / Next.js

/* app/globals.css */
@import "tailwindcss";
@import "@frontiers/tailwind-plugin";

Vite

/* src/main.css */
@import "tailwindcss";
@import "@frontiers/tailwind-plugin";

Benefits

  1. Extends tailwindcss-primeui - Builds on the base PrimeUI plugin with additional utilities
  2. Frontiers Design System - Designed for @frontiers/prime-preset theme and PrimeVue components
  3. Brink Design System Utilities - 72 typography and 50 elevation utilities from Brink Design System, converted to Tailwind 4 utilities
  4. Consistent Design - Use the same colors across PrimeVue components and Tailwind utilities
  5. Theme Integration - Colors automatically update when you change PrimeVue themes
  6. Developer Experience - Familiar Tailwind syntax with PrimeVue colors
  7. No Duplication - Single source of truth for color values (from @frontiers/prime-preset)
  8. Zero Runtime - Pure CSS, no JavaScript overhead

Troubleshooting

Colors not showing up?

Make sure:

  1. You're using Tailwind CSS v4.0+
  2. @primeuix/themes is installed and configured
  3. tailwindcss-primeui is installed
  4. PrimeVue CSS variables (--p-*) are available in your app
  5. The plugin is imported after Tailwind in your CSS

Different colors than expected?

The colors come from your PrimeVue theme configuration. To change colors, update your PrimeVue theme preset.

License

ISC

Author

Alexis Reina

版本与发布记录

@frontiers/tailwind-plugin 共发布 7 个版本,首次发布于 2025/10/24;过去 12 个月发布了 4 个版本。

版本发布日期距今
1.2.2latest2026/06/224 个月前
1.2.12026/06/194 个月前
1.2.02026/06/194 个月前
1.1.02026/01/279 个月前
1.0.22025/10/251.1 年前
1.0.12025/10/251.1 年前

关于 @frontiers/tailwind-plugin 的常见问题

@frontiers/tailwind-plugin 是什么?

Tailwind CSS 4 plugin that extends tailwindcss-primeui with custom utilities for PrimeVue components and @frontiers/prime-preset theme

如何安装 @frontiers/tailwind-plugin?

在项目目录运行 npm install @frontiers/tailwind-plugin,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:tailwindcss(>=4.0.0)、@primeuix/themes(>=1.0.0)、tailwindcss-primeui(>=0.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@frontiers/tailwind-plugin 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/frontiers__tailwind-plugin 是否存在。

@frontiers/tailwind-plugin 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@frontiers/tailwind-plugin 可以商用吗?

@frontiers/tailwind-plugin 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@frontiers/tailwind-plugin 的下载量有多少?

根据 npm 官方下载统计,@frontiers/tailwind-plugin 在 2026/10/16 – 2026/11/14 这 30 天内被下载 8,259 次,日均约 275 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@frontiers/tailwind-plugin 还在维护吗?

最新版本 1.2.2 发布于 2026/06/22(4 个月前);至今共发布 7 个版本,其中过去 12 个月发布了 4 个;首次发布于 2025/10/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。