@farming-labs/theme

中文文档
0.2.146发布于 2026/11/14MITTypeScriptES Module近 30 天下载 8.8万

Theme package for @farming-labs/docs — layout, provider, MDX components, and styles

原始使用文档
文档目录7 节
  1. Where it fits
  2. Install
  3. Choose a theme
  4. Main entrypoints
  5. Runtime requirements
  6. Learn more
  7. License

@farming-labs/theme

The React UI layer and shared theme preset package for @farming-labs/docs.

It provides the docs shell, root providers, MDX components, search and AI interfaces, theme factories, and the CSS used across every Farming Labs framework integration.

Where it fits

  • Next.js and TanStack Start: supplies the React layout, providers, components, and CSS
  • SvelteKit, Astro, and Nuxt: supplies shared preset CSS while the matching *-theme package supplies framework-native UI components
  • @farming-labs/docs: supplies the shared configuration, content features, and CLI

Install

For Next.js:

npm install @farming-labs/docs @farming-labs/next @farming-labs/theme

For TanStack Start:

npm install @farming-labs/docs @farming-labs/tanstack-start @farming-labs/theme

The setup CLI installs the correct package set automatically:

npx @farming-labs/docs@latest init

Choose a theme

Use a theme factory in docs.config.ts:

import { defineDocs } from "@farming-labs/docs";
import { fumadocs } from "@farming-labs/theme";

export default defineDocs({
  entry: "docs",
  theme: fumadocs(),
});

Then import its CSS. The default fumadocs() preset uses the default/css entrypoint:

@import "tailwindcss";
@import "@farming-labs/theme/default/css";

Other presets use matching factory and CSS subpaths:

import { hardline } from "@farming-labs/theme/hardline";
@import "@farming-labs/theme/hardline/css";

Available preset subpaths include default, darksharp, pixel-border, colorful, shiny, darkbold, greentree, hardline, concrete, command-grid, ledger, shadcn, and threadline.

The shadcn preset uses a flat desktop table of contents without decorative rails. Active sections use text color; the mobile popover keeps its indented rail and heading navigation.

Main entrypoints

createDocsLayout() prepares navigation and page metadata together, reading each page once per preparation pass. In production, the layout reuses that data across page renders within the same layout instance, including static generation during next build. Content changes are picked up by a new build/process; development renders refresh the data to reflect edits, new pages, and deleted pages. No additional configuration is required.

EntrypointPurpose
@farming-labs/themeDefault theme, RootProvider, layout helpers, and React UI
@farming-labs/theme/<preset>Theme factory for a preset
@farming-labs/theme/<preset>/cssComplete CSS for a preset
@farming-labs/theme/mdxFarming Labs MDX component map
@farming-labs/theme/searchLegacy createDocsSearchAPI() compatibility helper
@farming-labs/theme/aiAI search and chat UI
@farming-labs/theme/tanstackTanStack Start provider and layout integration

DocsCommandSearch keeps its keyboard and search-button triggers available on page load. The dialog loads on first use, shows a dismissible loading state, and retains recent searches and cached results across closes. This behavior is shared by Next.js, TanStack Start, and browser-runtime layouts.

Runtime requirements

The package currently declares Next.js 16+, React 19.2+, and React DOM 19.2+ as peers because its root entrypoints provide the React and Next.js UI. SvelteKit, Astro, and Nuxt integrations consume the shared CSS subpaths while rendering UI through their framework-native theme packages.

Learn more

License

MIT

版本与发布记录

@farming-labs/theme 共发布 378 个版本,首次发布于 2026/02/19;过去 12 个月发布了 378 个版本。

版本发布日期距今
0.2.146latest2026/11/14今天
0.2.1452026/11/131 天前
0.2.1442026/11/131 天前
0.2.1432026/11/068 天前
0.2.1422026/11/068 天前
0.2.1412026/11/059 天前

其他发布通道:perf → 0.2.133-perf.1,beta → 0.2.139-beta.1。

关于 @farming-labs/theme 的常见问题

@farming-labs/theme 是什么?

Theme package for @farming-labs/docs — layout, provider, MDX components, and styles

如何安装 @farming-labs/theme?

在项目目录运行 npm install @farming-labs/theme,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@farming-labs/docs(^0.2.146)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@farming-labs/theme 支持 TypeScript 吗?

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

@farming-labs/theme 支持 ESM 还是 CommonJS?

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

@farming-labs/theme 可以商用吗?

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

@farming-labs/theme 的下载量有多少?

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

@farming-labs/theme 还在维护吗?

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