@sesamehr/react-design-system

中文文档
3.14.0发布于 2026/11/02MITTypeScriptES Module

Sesame HR React design system — components and design tokens

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. Design tokens
  4. What the stylesheet does not do
  5. License

@sesamehr/react-design-system

React components and design tokens for the Sesame HR design system.

📖 Component documentation — this package's Storybook. The Vue source of truth has its own at vue-storybook.sesametime.com.

Install

npm install @sesamehr/react-design-system react react-dom tailwindcss

Usage

Import the stylesheet once at your app entry:

import '@sesamehr/react-design-system/style.css';

That stylesheet paints this package's components and nothing else. It carries no reset and no utility classes, so importing it cannot restyle the application around it — see What the stylesheet does not do.

Every component is exported with the Ox prefix:

import {
  OxAvatar,
  OxButton,
  OxFieldGroup,
  OxFieldLabel,
  OxFieldMessage,
  OxInputText,
} from '@sesamehr/react-design-system';
import { useState } from 'react';

export function Example() {
  const [email, setEmail] = useState('');

  return (
    <>
      <OxAvatar initials="SH" size="lg" dataTestid="user-avatar" />

      <OxFieldGroup variant="error">
        <OxFieldLabel htmlFor="email">Email</OxFieldLabel>
        <OxInputText
          id="email"
          field={email}
          onFieldChange={setEmail}
          placeholder="[email protected]"
        />
        <OxFieldMessage variant="error">Invalid email</OxFieldMessage>
      </OxFieldGroup>

      <OxButton variant="default">Save</OxButton>
    </>
  );
}

Design tokens

The stylesheet already contains the tokens. To @reference the raw token layers from your own Tailwind setup:

@import '@sesamehr/react-design-system/assets/styles/mainTheme.css';

What the stylesheet does not do

style.css contains this package's component rules and its tokens. It deliberately does not contain:

  • Preflight, or any other global reset. The components assume one — they are written against box-sizing: border-box, button { font: inherit } and the rest — but installing it is the application's call, not a library's. If your app has Tailwind, you already have it. If it does not:

    import '@sesamehr/react-design-system/preflight.css';
    
  • Utility classes. No .h-10, no .p-4, no .bg-brand. Every component carries its own ox-prefixed class and the declarations are compiled into it, so nothing here can collide with the identically-named utilities your own Tailwind build emits from your scale.

Component rules ship inside @layer components, which is where a Tailwind app already sorts them: after base, before utilities. So a utility you pass in wins — <Button className="w-full"> is full width — without needing !important.

Tokens are published under an --ox- prefix: override --ox-color-brand-500 to retheme, not --color-brand-500. Unprefixed, those are the names Tailwind itself uses, and declaring them at :root would change what every rounded-2xl in your application means.

License

MIT © Sesame HR

版本与发布记录

@sesamehr/react-design-system 共发布 58 个版本,首次发布于 2026/07/21;过去 12 个月发布了 58 个版本。

版本发布日期距今
3.14.0latest2026/11/021 天前
3.13.02026/10/304 天前
3.12.02026/10/294 天前
3.11.02026/10/295 天前
3.10.22026/10/277 天前
3.10.12026/10/267 天前

其他发布通道:beta → 3.1.0-beta.2。

关于 @sesamehr/react-design-system 的常见问题

@sesamehr/react-design-system 是什么?

芝麻HR React设计系统-组件和设计令牌

如何安装 @sesamehr/react-design-system?

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

@sesamehr/react-design-system 支持 TypeScript 吗?

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

@sesamehr/react-design-system 支持 ESM 还是 CommonJS?

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

@sesamehr/react-design-system 可以商用吗?

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

@sesamehr/react-design-system 还在维护吗?

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