@darkalpha/nova-ui

中文文档
0.9.0发布于 2026/11/14MITTypeScriptES Module构建来源已验证近 30 天下载 2084

Colorful, accessible, themeable React components for the Nova UI design system.

原始使用文档
文档目录4 节
  1. Entry points
  2. Rich text editor
  3. Apps that use Tailwind CSS v4
  4. ThemeProvider

@darkalpha/nova-ui

Colorful, accessible, themeable React components.

pnpm add @darkalpha/nova-ui
import { Button, ThemeProvider } from "@darkalpha/nova-ui";
import "@darkalpha/nova-ui/styles.css";

<ThemeProvider theme="ocean" brand={{ primary: "#0f766e" }}>
  <Button>Get started</Button>
</ThemeProvider>;

Entry points

ImportContents
@darkalpha/nova-uiComponents, ThemeProvider, ThemeScript, hooks, cn, and the token API (createTheme, registerTheme, auditContrast…)
@darkalpha/nova-ui/styles.cssRequired once (unless you use tailwind.css). Tokens, a reset scoped to .nv-theme, and component styles. No global preflight.
@darkalpha/nova-ui/themes.cssOptional. All presets as [data-nv-theme="…"] blocks for zero-JS theming.
@darkalpha/nova-ui/react-hook-formOptional bindings for react-hook-form (any resolver, e.g. zod). Requires react-hook-form ≥ 7.55; never loaded by the main entry.
@darkalpha/nova-ui/rich-text-editorRichTextEditor and RichTextViewer, built on Tiptap/ProseMirror. Tiptap is an optional peer dependency: install it only if you use the editor (command below). Its styles are already in styles.css.
@darkalpha/nova-ui/kavehThe Kaveh brand kit (logo family, brand elements, page sections, cards) and the Yalda/Nowruz seasonal artwork. Use with the kaveh, kaveh-yalda and kaveh-nowruz themes.
@darkalpha/nova-ui/tailwind.cssFor Tailwind v4 apps, instead of styles.css: @import "tailwindcss"; @import "@darkalpha/nova-ui/tailwind.css";

Rich text editor

Tiptap is not installed with Nova UI. Apps that import @darkalpha/nova-ui/rich-text-editor add it themselves:

pnpm add @tiptap/core @tiptap/pm @tiptap/react @tiptap/starter-kit @tiptap/extensions @tiptap/suggestion @tiptap/extension-bubble-menu @tiptap/extension-highlight @tiptap/extension-image @tiptap/extension-list @tiptap/extension-subscript @tiptap/extension-superscript @tiptap/extension-table @tiptap/extension-text-align @tiptap/extension-text-style @tiptap/extension-typography

Apps that use Tailwind CSS v4

Import tailwind.css from your CSS entry and drop the styles.css import:

@import "tailwindcss";
@import "@darkalpha/nova-ui/tailwind.css";

It ships Nova UI as source (tokens, scoped base, materials, token utilities such as bg-primary) plus an @source for the components, so your build generates the component utilities together with yours. Loading the precompiled styles.css as well gives you two separately sorted utilities layers: your .flex-col can then follow the library's sm:flex-row and win at every width. With a class prefix (prefix(tw)), use styles.css instead; prefixed utilities can't collide with the components'.

ThemeProvider

PropTypeDefault
themepreset name, registered id, or ThemeDefinition"vibrant"
brand{ primary?, secondary?, accent?, neutral? } (hex)—
overrides{ light?: {...}, dark?: {...} } semantic tokens—
mode / defaultMode / onModeChange"light" | "dark" | "system"theme preference, else "system"
storageKeypersist the mode (pair with <ThemeScript>)—
radius"none" | "sm" | "md" | "lg" | "xl"from theme
density"compact" | "comfortable" | "spacious"from theme
fonts{ sans?, display?, mono? }from theme
motion"system" | "reduce""system"
dir"ltr" | "rtl"inherited, else "ltr"

Full documentation, the token reference and the theme playground are in apps/docs.

Peer dependencies: react and react-dom 18.2+ or 19.

版本与发布记录

@darkalpha/nova-ui 共发布 13 个版本,首次发布于 2026/11/04;过去 12 个月发布了 13 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.0latest2026/11/14今天
0.8.02026/11/104 天前
0.7.02026/11/104 天前
0.6.02026/11/095 天前
0.5.12026/11/095 天前
0.5.02026/11/086 天前

关于 @darkalpha/nova-ui 的常见问题

@darkalpha/nova-ui 是什么?

Colorful, accessible, themeable React components for the Nova UI design system.

如何安装 @darkalpha/nova-ui?

在项目目录运行 npm install @darkalpha/nova-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.2.0 || ^19.0.0)、react-dom(^18.2.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@darkalpha/nova-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@darkalpha/nova-ui 支持 ESM 还是 CommonJS?

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

@darkalpha/nova-ui 可以商用吗?

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

@darkalpha/nova-ui 的下载量有多少?

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

@darkalpha/nova-ui 还在维护吗?

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