@basenative/icons

中文文档
3.3.0发布于 2026/11/03Apache-2.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 1969

SVG icon set and FOUC-preventing reset stylesheet for BaseNative applications

原始使用文档
文档目录6 节
  1. Install
  2. Quick Start
  3. With @basenative/server
  4. Available Icons
  5. Styling
  6. License

@basenative/icons

Minimal SVG icon set for BaseNative UI components

Part of the BaseNative ecosystem — a signal-based web runtime over native HTML.

Install

npm install @basenative/icons

Quick Start

// Inline an SVG icon in a server-rendered template
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { join, dirname } from 'node:path';

const __dirname = dirname(fileURLToPath(import.meta.url));

function icon(name) {
  return readFileSync(
    join(__dirname, 'node_modules/@basenative/icons/src', `${name}.svg`),
    'utf-8'
  );
}

const html = `
  <button type="button">
    ${icon('plus')} Add item
  </button>
`;

With @basenative/server

import { render } from '@basenative/server';
import { readFileSync } from 'node:fs';

const plusIcon = readFileSync('./node_modules/@basenative/icons/src/plus.svg', 'utf-8');

const html = render('<button>{{ icon }} Add</button>', { icon: plusIcon });

Available Icons

Icons live in src/ as plain .svg files. Each SVG is sized for inline use and inherits currentColor.

FileDescription
activity.svgPulse / activity feed
bar-chart.svgBar chart / reports
calendar.svgCalendar / scheduled jobs
check.svgCheckmark / confirmation
chevron-down.svgDownward chevron for dropdowns
chevron-left.svgLeft chevron / back
chevron-right.svgRight chevron / forward
clock.svgClock / time
dashboard.svgDashboard grid / today view
file-text.svgDocument / estimate
mail.svgEnvelope / email
map-pin.svgLocation pin
megaphone.svgMegaphone / campaigns
menu.svgHamburger menu
message-square.svgChat bubble with message lines
minus.svgMinus / remove / collapse
package.svgBox / inventory
phone.svgTelephone handset
plug.svgPlug / plugins and integrations
plus.svgPlus / add / expand
remove.svgX / close / dismiss
search.svgMagnifying glass / search
settings.svgGear / settings
shield.svgShield / trust and protection
star.svgStar / reviews and ratings
trending-up.svgRising chart / opportunities
truck.svgTruck / vehicles
user-plus.svgPerson with plus / new lead
users.svgPeople / customers

Styling

Icons inherit color from their parent element via currentColor and scale with em/font-size. Apply classes or inline width/height to control size:

.icon { width: 1em; height: 1em; vertical-align: middle; }

License

Apache-2.0

版本与发布记录

@basenative/icons 共发布 14 个版本,首次发布于 2026/10/18;过去 12 个月发布了 14 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.3.0latest2026/11/035 天前
3.2.02026/11/035 天前
3.1.02026/11/017 天前
3.0.02026/10/317 天前
2.4.02026/10/2613 天前
2.3.22026/10/2217 天前

关于 @basenative/icons 的常见问题

@basenative/icons 是什么?

SVG icon set and FOUC-preventing reset stylesheet for BaseNative applications

如何安装 @basenative/icons?

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

@basenative/icons 支持 TypeScript 吗?

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

@basenative/icons 支持 ESM 还是 CommonJS?

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

@basenative/icons 可以商用吗?

@basenative/icons 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@basenative/icons 的下载量有多少?

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

@basenative/icons 还在维护吗?

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