@silkrun/ui

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

Silkrun React component library with theme CSS

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. Light and dark mode
  4. Components
  5. License

@silkrun/ui

React components and theme CSS for Silkrun apps.

Install

npm install @silkrun/ui react react-dom

Requires React 18.

Usage

Import the stylesheet once at your app's entry point, then import each component from its own path:

import '@silkrun/ui/styles.css'
import { Button } from '@silkrun/ui/button'
import { Dialog } from '@silkrun/ui/dialog'

export function App() {
  return <Button>Save</Button>
}

There is no root @silkrun/ui import. Per-component paths keep your bundle to the components you use.

The stylesheet is precompiled, so your app needs no Tailwind setup. Fonts are bundled and referenced by relative URL, so any bundler that handles CSS url() (Vite, webpack, Next.js) copies them for you.

Light and dark mode

Set data-theme on <html>:

<html data-theme="dark">

Components read the attribute and have no theme prop of their own. Without it, the light theme applies.

Components

accordion, account-menu, action-bar, action-sheet, alert, app-card, app-header, app-icon-status, avatar, badge, bottom-dock, breadcrumb, button, calendar, card, checkbox, checkbox-group, chip, code, command-dialog, context-menu, copy-field, corner-cluster, date-picker, descriptions, dialog, divider, dot, dropdown-menu, dynamic-island, empty-state, event-block, fab, field, file-drop, form, grid, heading, hover-actions, hover-card, icon, icon-button, image, image-grid, input, launchpad, lazy-load, list, markdown-text, media-viewer, message-row, messages, overlay, page-header, pagination, pane, pane-header, picker, popconfirm, popover, progress, radio-group, rich-text-input, row, row-group, scroll-area, search-trigger, segmented, select, settings-navigation, sheet, sidebar-app-identity, sidebar-nav, sidebar-screen, sidebar-shell, sidebar-user, skeleton, slider, smart-list, spinner, splitter, stack, stage-progress, surface, switch, tab-bar, table, tabs, tags-input, text, text-diff, textarea, time-picker, toaster, tool-use, tooltip, topbar-ghost, ui-provider, use-roving-focus, workspace-stage

Each name is its import path: @silkrun/ui/<name> (or @silkrun/ui/components/<name>). select also has @silkrun/ui/components/select/native-select, and @silkrun/ui/lib/cn is the class-name helper.

rich-text-input needs the Lexical packages, which are optional peers: install lexical and the @lexical/* packages listed in this package's peerDependencies if you use it.

License

MIT. Bundled fonts keep their own licenses: Noto Sans (Apache 2.0) and Roboto (SIL Open Font License 1.1), in theme/fonts/.

版本与发布记录

@silkrun/ui 共发布 18 个版本,首次发布于 2026/09/29;过去 12 个月发布了 18 个版本。

版本发布日期距今
0.1.17latest2026/11/021 天前
0.1.162026/10/2310 天前
0.1.152026/10/2310 天前
0.1.142026/10/2311 天前
0.1.132026/10/2311 天前
0.1.122026/10/2311 天前

关于 @silkrun/ui 的常见问题

@silkrun/ui 是什么?

带有主题CSS的Silkrun React组件库

如何安装 @silkrun/ui?

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

@silkrun/ui 支持 TypeScript 吗?

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

@silkrun/ui 支持 ESM 还是 CommonJS?

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

@silkrun/ui 可以商用吗?

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

@silkrun/ui 还在维护吗?

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