← 返回
未分类

primevue

PrimeVue UI component library for Vue.js with 100+ components. Covers design token theming, unstyled mode, pass-through (pt) styling, forms with validation,...
PrimeVue 为 Vue.js 提供的 UI 组件库,包含 100+ 组件,支持设计令牌主题、无样式模式、透传 (pt) 样式、表单验证等功能。
yuexiaoliang yuexiaoliang 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 378
下载
💾 0
安装
1
版本
#latest

概述

PrimeVue

PrimeVue is a next-generation Vue.js UI component suite by PrimeTek. Features 100+ components, design token-based theming, and unstyled mode for Tailwind/CSS integration.

Quick Start

npm install primevue @primevue/themes
import { createApp } from 'vue';
import PrimeVue from 'primevue/config';
import Aura from '@primeuix/themes/aura';

const app = createApp(App);
app.use(PrimeVue, {
    theme: { preset: Aura, options: { darkModeSelector: '.dark' } },
    ripple: true
});

Core Concepts

Two Styling Modes

Styled Mode (default): Pre-skinned components with design token theming. Built-in presets: Aura, Material, Lara, Nora.

Unstyled Mode: Components render without styles, fully styled via Pass Through (pt) with Tailwind, Bootstrap, or custom CSS.

Pass Through (pt)

Access internal DOM of any component to add arbitrary attributes, classes, aria, or events — no need to wait for component API updates.

<Button
    label="Search"
    icon="pi pi-search"
    :pt="{
        root: 'bg-teal-500 hover:bg-teal-700',
        label: 'text-white font-bold'
    }"
/>

Design Tokens

Three-tier token system: primitive (raw values like colors) → semantic (meaningful names like primary.color) → component (per-component like button.background).

Popular Components

ComponentTagUse Case
--------------------------
ButtonActions, submit
DataTableTabular data with sorting/filtering
DialogModal overlay
InputTextText input
DropdownSingle selection
MultiSelectMultiple selection
ToastNotifications
MenuNavigation/list
DialogOverlay content
CardContent container
PanelCollapsible content
ToolbarButton grouping

Forms

PrimeVue Forms library (@primevue/forms) provides state management with built-in validation.

<Form v-slot="$form" :initialValues :resolver @submit="onSubmit">
    <InputText name="username" />
    <Message v-if="$form.username?.invalid">{{ $form.username.error.message }}</Message>
    <Button type="submit" />
</Form>

Resolvers available for: Zod, Yup, Joi, Valibot, Superstruct.

Configuration

app.use(PrimeVue, {
    ripple: true,              // Enable ripple effect
    inputVariant: 'filled',    // 'outlined' | 'filled'
    unstyled: false,           // Enable unstyled mode globally
    theme: {
        preset: Aura,
        options: {
            prefix: 'p',
            darkModeSelector: '.dark',
            cssLayer: false
        }
    },
    pt: { /* global pass-through */ },
    zIndex: {
        modal: 1100,
        overlay: 1000,
        menu: 1000,
        tooltip: 1100
    }
});

Theming

Use Built-in Preset

import Aura from '@primeuix/themes/aura';
app.use(PrimeVue, { theme: { preset: Aura } });

Customize Preset

import { definePreset } from '@primeuix/themes';
const MyPreset = definePreset(Aura, {
    semantic: {
        primary: {
            50: '{indigo.50}',
            500: '{indigo.500}',
            // ... 50-950
        },
        colorScheme: {
            light: { surface: { 0: '#fff' } },
            dark: { surface: { 0: '#1a1a1a' } }
        }
    }
});
app.use(PrimeVue, { theme: { preset: MyPreset } });

Runtime Updates

import { updatePreset, usePreset } from '@primeuix/themes';
updatePreset({ semantic: { primary: { 500: '#f59e0b' } } });
usePreset(MyPreset);  // Replace entirely

Icons

<i class="pi pi-check"></i>
<span class="pi pi-spin pi-spinner"></span>

// Custom icon
<Select>
    <template #dropdownicon>
        <i class="fa-solid fa-chevron-down"></i>
    </template>
</Select>

Installation Options

# Vite
npm create vite@latest my-app -- --template vue
npm install primevue @primevue/themes

# Nuxt
npm install @primeuix/nuxt

# Laravel
npm install primevue @primevue/themes
# Follow Laravel integration guide

# CDN
<script src="https://unpkg.com/primevue/umd/primevue.min.js"></script>

Reference Docs

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 09:48 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 75 📥 182,338
dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 41,814
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 196 📥 67,901