@c2n/symbols

中文文档
1.0.23发布于 2026/11/08MITTypeScriptES Module近 30 天下载 2576

157 spot illustrations as Lit web components, for empty states, status panels, onboarding, commerce, security and error pages: <c2-symbol-empty-inbox>, <c2-symbol-no-results>, <c2-symbol-success>, and more.

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. In a status panel
  4. Theming
  5. Adding or editing a symbol

Symbols

157 spot illustrations as Lit web components, for empty states, status panels, onboarding, commerce, security and error pages: <c2-symbol-empty-inbox>, <c2-symbol-no-results>, <c2-symbol-success>, and more.

The artwork is drawn for this package (MIT, like the rest of the repository) on one 160×160 grid, and every colour in it comes from a small set of themeable roles, so a theme recolours the whole set at once and dark mode works through @c2n/theme.

Installation

npm install @c2n/symbols

Usage

Import only the symbols you use:

import '@c2n/symbols/symbols/empty-inbox.js'
<c2-symbol-empty-inbox></c2-symbol-empty-inbox>

Or register the whole set:

import '@c2n/symbols'

A symbol is decorative by default (aria-hidden). Give it a label when it carries meaning that no nearby text repeats:

<c2-symbol-offline label="You are offline"></c2-symbol-offline>

The symbol names, catalog (title, category, description), tag helper and SymbolElement base class are exported from the package root.

In a status panel

<c2-status-panel media="illustration" heading="No results" description="Try a different keyword or clear the filters.">
  <c2-symbol-no-results slot="media"></c2-symbol-no-results>
</c2-status-panel>

Theming

PropertyDefaultRole
--c2-symbol--size120pxWidth and height
--c2-symbol--stroke-width3Outline width on the 160×160 canvas
--c2-symbol__backdrop--color#f4f4f5Soft disc behind the artwork
--c2-symbol__surface--color#ffffffFaces of objects, marks drawn on coloured shapes
--c2-symbol__muted--color#e4e4e7Secondary fills, ground shadows
--c2-symbol__line--color#a1a1aaDefault outline
--c2-symbol__ink--color#71717aSmall solid details
--c2-symbol__primary--color#0265dcAccent
--c2-symbol__primary-soft--color#edf1feSoft accent fills
--c2-symbol__accent--color#fbbf24Golden highlight: stars, coins, bulbs, confetti
--c2-symbol__success--color#16a34aSuccess badges
--c2-symbol__warning--color#f59e0bWarning badges and hazard signs
--c2-symbol__error--color#dc2626Error badges and strike-throughs

Set --c2-symbol__backdrop--color: transparent to drop the disc.

Adding or editing a symbol

The components under src/symbols/ are generated and committed. The sources are svg/<name>.svg plus an entry in svg/catalog.json (title, category — empty, status, error, security, commerce, communication, files or onboarding — and description). A source must use the exact wrapper <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 160"> and take every colour from a class: a fill role (backdrop, surface, muted, ink, primary, primary-soft, accent, success, warning, error), the default outline line, or a coloured stroke line-<role>. The generator rejects fill, stroke, style and any other class. Then run:

npm run generate -w packages/icons/symbols
npm run build -w packages/icons/symbols

版本与发布记录

@c2n/symbols 共发布 31 个版本,首次发布于 2026/09/30;过去 12 个月发布了 31 个版本。

版本发布日期距今
1.0.23latest2026/11/081 天前
1.0.222026/11/072 天前
1.0.212026/11/054 天前
1.0.202026/11/035 天前
1.0.192026/11/035 天前
1.0.182026/10/2811 天前

关于 @c2n/symbols 的常见问题

@c2n/symbols 是什么?

157 spot illustrations as Lit web components, for empty states, status panels, onboarding, commerce, security and error pages: <c2-symbol-empty-inbox>, <c2-symbol-no-results>, <c2-symbol-success>, and more.

如何安装 @c2n/symbols?

在项目目录运行 npm install @c2n/symbols,或使用 pnpm add / yarn add / bun add。

@c2n/symbols 支持 TypeScript 吗?

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

@c2n/symbols 支持 ESM 还是 CommonJS?

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

@c2n/symbols 可以商用吗?

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

@c2n/symbols 的下载量有多少?

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

@c2n/symbols 还在维护吗?

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