@ecologi-action-ltd/mycelia

中文文档
0.52.0发布于 2026/11/05MITTypeScriptES Module近 30 天下载 1.2万

Mycelia Design System - Accessible React components with vanilla-extract styling

原始使用文档
文档目录19 节
  1. Features
  2. Installation
  3. Typography
  4. Setup
  5. 1. Import styles
  6. 2. Apply the theme
  7. Next.js App Router
  8. Client-side routing
  9. Next.js App Router example
  10. 3. Use components
  11. Using Tokens
  12. Documentation
  13. Development
  14. Releasing
  15. Adding a changeset
  16. When to add a changeset
  17. How releases work
  18. Testing PR changes
  19. License

Mycelia Design System

A React component library built with React Aria Components and vanilla-extract.

Features

  • Accessible by default - Built on React Aria Components for full WCAG compliance
  • Type-safe tokens - Design tokens available as TypeScript values or vanilla-extract theme contracts
  • Figma aligned - Tokens and components match the Mycelia Figma Design System

Installation

npm install @ecologi-action-ltd/mycelia

Typography

Mycelia uses Hanken Grotesk as its primary typeface. Add this to your HTML <head>:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">

Or import in your CSS:

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

Setup

1. Import styles

Import the CSS file in your app's entry point:

import '@ecologi-action-ltd/mycelia/styles.css';

2. Apply the theme

Add the theme class to your root element. Import it from @ecologi-action-ltd/mycelia/theme:

import { myceliaTheme } from '@ecologi-action-ltd/mycelia/theme';

// In your root layout/component
<body className={myceliaTheme}>
  {children}
</body>

Next.js App Router

For Next.js App Router, your layout.tsx should look like:

import '@ecologi-action-ltd/mycelia/styles.css';
import { myceliaTheme } from '@ecologi-action-ltd/mycelia/theme';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <link rel="preconnect" href="https://fonts.googleapis.com" />
        <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
        <link
          href="https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&display=swap"
          rel="stylesheet"
        />
      </head>
      <body className={myceliaTheme}>
        {children}
      </body>
    </html>
  );
}

Client-side routing

For Link components to work with client-side navigation, wrap your app with RouterProvider. This is exported from a separate entry point to avoid requiring "use client" in server components.

For full details, see the React Aria routing documentation.

Next.js App Router example

Create a client provider component:

// app/providers.tsx
"use client";

import { RouterProvider } from '@ecologi-action-ltd/mycelia/router';
import { useRouter } from 'next/navigation';

export function Providers({ children }: { children: React.ReactNode }) {
  const router = useRouter();
  return <RouterProvider navigate={router.push}>{children}</RouterProvider>;
}

Then use it in your layout:

// app/layout.tsx
import '@ecologi-action-ltd/mycelia/styles.css';
import { myceliaTheme } from '@ecologi-action-ltd/mycelia/theme';
import { Providers } from './providers';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body className={myceliaTheme}>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}

3. Use components

import { Button, Text } from '@ecologi-action-ltd/mycelia';

<Text variant="h1">Welcome to Mycelia</Text>
<Button variant="primary">Get Started</Button>

Using Tokens

Tokens can be used directly in your own styles without vanilla-extract:

import { tokens } from '@ecologi-action-ltd/mycelia/tokens';

const styles = {
  backgroundColor: tokens.color.surface.primary.default,
  borderRadius: tokens.radius.md,
  padding: tokens.spacing['16'],
};

For vanilla-extract users, use the theme contract for type-safe CSS variable access:

import { vars } from '@ecologi-action-ltd/mycelia/theme';
import { style } from '@vanilla-extract/css';

export const card = style({
  backgroundColor: vars.color.surface.primary.default,
  borderRadius: vars.radius.md,
});

Documentation

Run Storybook to explore all components and tokens:

npm run storybook

Development

See CONTRIBUTING.md for development setup and adding new components.

Releasing

This project uses Changesets for version management and releases.

Adding a changeset

When making changes that should be released, create a changeset:

npm run changeset

This will prompt you to:

  1. Select the type of change (patch, minor, major)
  2. Write a summary of the changes

A markdown file will be created in .changeset/ - commit this with your PR.

When to add a changeset

  • patch: Bug fixes, documentation updates
  • minor: New features, non-breaking changes
  • major: Breaking changes

Skip changesets for internal changes like CI updates or refactors that don't affect the public API.

How releases work

  1. PRs with changesets are merged to main
  2. A "Version Packages" PR is automatically created/updated
  3. When the Version PR is merged, the package is published to npm

Testing PR changes

PR preview packages are automatically published. Install them via the link in the PR comments:

npm i https://pkg.pr.new/@ecologi-action-ltd/mycelia@<commit-hash>

License

MIT

版本与发布记录

@ecologi-action-ltd/mycelia 共发布 75 个版本,首次发布于 2026/02/03;过去 12 个月发布了 75 个版本。

版本发布日期距今
0.52.0latest2026/11/058 天前
0.51.02026/10/2618 天前
0.50.02026/10/2222 天前
0.49.02026/10/1529 天前
0.48.02026/10/1430 天前
0.47.02026/10/1430 天前

关于 @ecologi-action-ltd/mycelia 的常见问题

@ecologi-action-ltd/mycelia 是什么?

Mycelia Design System - Accessible React components with vanilla-extract styling

如何安装 @ecologi-action-ltd/mycelia?

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

@ecologi-action-ltd/mycelia 支持 TypeScript 吗?

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

@ecologi-action-ltd/mycelia 支持 ESM 还是 CommonJS?

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

@ecologi-action-ltd/mycelia 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ecologi-action-ltd/mycelia 可以商用吗?

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

@ecologi-action-ltd/mycelia 的下载量有多少?

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

@ecologi-action-ltd/mycelia 还在维护吗?

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