@batoanng/mui-components

中文文档
3.7.0发布于 2026/06/06MITTypeScriptES Module近 30 天下载 1.7万

npm version [install size](https://packagephobia.com/result?p=@batoanng/mui-

原始使用文档
文档目录8 节
  1. ✨ Features
  2. 📦 Installation
  3. 🚀 Quick Start
  4. 🧩 Components Structure
  5. 🎨 Theming System
  6. 🧰 Development
  7. 📖 Storybook
  8. Package Size

@batoanng/mui-components

npm version install size Storybook

A fully typed, themeable, and accessible component library built with React, TypeScript, and Material UI (MUI). It follows atomic design principles and ships with a complete theming system, hooks, test utilities, and form support to accelerate UI development across multiple projects.


✨ Features

  • Built on MUI 9
  • Organized by Atomic Design (Atoms, Molecules, Forms)
  • Theming support (Light/Dark mode, tokenized palette, typography)
  • Custom hooks and utilities
  • Ready-to-use with ThemeProvider and CssBaseline
  • Developer tooling: Storybook, Vitest, ESLint, Prettier
  • Published on npm and deployed Storybook: mui-components-batoanng.vercel.app

📦 Installation

npm install @batoanng/mui-components

You must also install peer dependencies if not already present:

npm install react react-dom @mui/material @mui/icons-material @mui/utils @emotion/react @emotion/styled framer-motion react-hook-form

Some exports need optional peer dependencies:

npm install @mui/x-date-pickers react-dropzone react-idle-timer

🚀 Quick Start

Wrap your application with the theme provider:

import { defaultTheme } from '@batoanng/mui-components';
import { CssBaseline, ThemeProvider } from '@mui/material';

export default function App() {
  return (
    <ThemeProvider theme={defaultTheme}>
      <CssBaseline />
      {/* Your app components */}
    </ThemeProvider>
  );
}

Use components:

import { Button } from '@batoanng/mui-components';

<Button variant="contained">Click me</Button>;

🧩 Components Structure

src/
├── components/
│   ├── atoms/           # Base building blocks (e.g., Button, Label)
│   ├── molecules/       # Compound components (e.g., IdleTimer)
│   ├── form/            # Input controls and validation-aware forms (integrated with react-hook-form)
│   └── index.ts         # Entry point for all component exports

All components are re-exported via @batoanng/mui-components:

import { FormTextField } from '@batoanng/mui-components';

Test utilities are exported from a separate subpath so production bundles do not include Testing Library:

import { render, screen } from '@batoanng/mui-components/test-utils';

🎨 Theming System

Located in src/theme/, it includes:

  • Light and Dark theme create function
  • Custom spacing, radii, shadows, typography
  • Color palette consistent with brand/UI tokens

Usage:

import { defaultTheme, createDefaultTheme } from '@batoanng/mui-components';

const lightTheme = createDefaultTheme({}); // Light theme is default
const darkTheme = createDefaultTheme({ darkTheme: true });

<ThemeProvider theme={lightTheme}>...</ThemeProvider>
<ThemeProvider theme={darkTheme}>...</ThemeProvider>

🧰 Development

Common commands:

pnpm dev             # Start Storybook
pnpm test            # Run unit tests with Vitest
pnpm lint            # Run ESLint
pnpm format          # Format with Prettier
pnpm build           # Build library output
pnpm clean           # Remove local build, Storybook, cache, and package install artifacts

Linting is configured through the local flat config entrypoint at eslint.config.mjs, which composes:

  • @batoanng/eslint-config
  • @batoanng/eslint-config/typed
  • @batoanng/eslint-config/test

📖 Storybook

View the full component library online:

👉 https://mui-components-batoanng.vercel.app/

To run locally:

pnpm dev

Package Size

The published package is checked with npm pack --dry-run. Local folder size can be much larger because ignored generated folders such as node_modules/.cache and storybook-static are created during development.

版本与发布记录

@batoanng/mui-components 共发布 42 个版本,首次发布于 2025/07/02;过去 12 个月发布了 24 个版本。

版本发布日期距今
3.7.0latest2026/06/065 个月前
3.6.02026/05/016 个月前
3.5.42026/04/286 个月前
3.5.32026/04/077 个月前
3.5.22026/04/067 个月前
3.5.12026/04/067 个月前

关于 @batoanng/mui-components 的常见问题

@batoanng/mui-components 是什么?

[](https://packagephobia.com/result?p=@batoanng/mui-

如何安装 @batoanng/mui-components?

在项目目录运行 npm install @batoanng/mui-components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@emotion/react(^11.14.0)、@emotion/styled(^11.14.1)、@mui/icons-material(9.0.0)、@mui/material(9.0.0)、@mui/utils(^9.0.0)、framer-motion(^12.38.0)、react(^19.2.5)、react-dom(^19.2.5)、react-hook-form(7.74.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@batoanng/mui-components 支持 TypeScript 吗?

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

@batoanng/mui-components 支持 ESM 还是 CommonJS?

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

@batoanng/mui-components 需要什么版本的 Node.js?

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

@batoanng/mui-components 可以商用吗?

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

@batoanng/mui-components 的下载量有多少?

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

@batoanng/mui-components 还在维护吗?

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