Inspira UI
New Component Released:图片徽章鳞片纹理
New Component Released:图片徽章鳞片纹理
New Component Released:图片徽章鳞片纹理
New Component Released:图片徽章鳞片纹理
入门指南

安装

如何在你的应用中安装 Inspira UI。

本指南将帮助你在 Vue 或 Nuxt 应用中安装并配置 Inspira UI 组件。

如果你正在使用 Tailwind CSS v3,请在这里查看 Inspira UI v1

开始使用 Inspira UI

配置 tailwindcss

首先,请按照 此指南 安装 tailwindcss

添加依赖

安装以下所需的辅助库。

npm install @vueuse/core motion-v tw-animate-css @inspira-ui/plugins

请参考此指南,在 Vue 或 Nuxt 中配置 motion-v

更新你的 main.css 文件

如果你正在使用 shadcn-vue 或 ,可以跳过此步骤

将以下代码添加到你的 main.css 文件中,用于配置组件所需的变量:

main.css
@import "tailwindcss";
@import "@nuxt/ui";

@theme static {
  --color-background: var(--ui-bg);
  --color-foreground: var(--ui-text);

  --color-card: var(--ui-bg-elevated);
  --color-card-foreground: var(--ui-text);

  --color-popover: var(--ui-bg-elevated);
  --color-popover-foreground: var(--ui-text);

  --color-muted: var(--ui-bg-muted);
  --color-muted-foreground: var(--ui-text-muted);

  --color-accent: var(--ui-bg-accented);
  --color-accent-foreground: var(--ui-text);

  --color-border: var(--ui-border);
  --color-input: var(--ui-border);

  --color-primary: var(--ui-primary);
  --color-primary-foreground: var(--ui-text-inverted);

  --color-secondary: var(--ui-secondary);
  --color-secondary-foreground: var(--ui-text-inverted);

  --color-destructive: var(--ui-error);
  --color-destructive-foreground: var(--ui-text-inverted);

  --color-ring: var(--ui-primary);

  --radius: var(--ui-radius);
}

:root {
  --background: var(--ui-bg);
  --foreground: var(--ui-text);

  --card: var(--ui-bg-elevated);
  --card-foreground: var(--ui-text);

  --popover: var(--ui-bg-elevated);
  --popover-foreground: var(--ui-text);

  --muted: var(--ui-bg-muted);
  --muted-foreground: var(--ui-text-muted);

  --accent: var(--ui-bg-accented);
  --accent-foreground: var(--ui-text);

  --border: var(--ui-border);
  --input: var(--ui-border);

  --primary: var(--ui-primary);
  --primary-foreground: var(--ui-text-inverted);

  --secondary: var(--ui-secondary);
  --secondary-foreground: var(--ui-text-inverted);

  --destructive: var(--ui-error);
  --destructive-foreground: var(--ui-text-inverted);

  --ring: var(--ui-primary);
}
太棒了!你的项目现在已经配置完成,可以使用 Inspira UI 了。

可选:添加图标支持

许多 Inspira UI 组件和示例会使用 <Icon> 组件和 Iconify 图标。虽然这是可选的,但我们强烈推荐安装,以获得更好的使用体验。

要在你的 Vue.js 或 Nuxt.js 项目中添加图标支持,请参考 Iconify Vue 指南

开始使用 Inspira UI 🚀

现在,你可以在项目中开始使用 Inspira UI 组件了。选择你需要的组件,复制代码,并将其集成到你的应用中。

Copyright © 2026