@arshiash80/strapi-plugin-iconhub

中文文档
1.3.1发布于 2026/04/19MITTypeScriptESM + CJS近 30 天下载 2271

Icon picker plugin for Strapi with Iconify integration — search, select, and store icons with raw SVG for high-performance rendering.

原始使用文档
文档目录22 节
  1. Table of contents
  2. Demo
  3. Why IconHub
  4. Compatibility
  5. Installation
  6. Add the field to a content type
  7. Field configuration
  8. Storage strategy
  9. Restrict available icon set categories
  10. Editor workflow
  11. 1. Browse icon sets
  12. 2. Refine the available sets
  13. 3. Search globally or open a specific set
  14. 4. Review different icon families
  15. 5. Edit and customize the selected icon
  16. Stored value shape
  17. Frontend rendering
  18. Render from iconName
  19. Render from iconData
  20. Development
  21. Documentation assets
  22. License

Strapi IconHub

Strapi IconHub

IconHub is a custom field for Strapi that brings the Iconify catalog into the admin panel. Editors can browse icon sets, search globally, inspect a single set in detail, apply colors, and store either the Iconify name, raw SVG, or both.

Strapi TypeScript License

Table of contents

Demo

Open the demo video directly

The demo covers the picker flow, icon set browsing, icon editing, and color customization.

Why IconHub

  • Built for Strapi editors, not just developers wiring icons in code
  • Access to 200,000+ icons through Iconify without shipping a bundled icon pack
  • Category-level restrictions in Content-Type Builder to keep fields focused
  • Collection-first browsing flow for teams that do not know the exact icon name
  • Raw SVG storage support for fast frontend rendering and external-API independence

Compatibility

  • Strapi v4 and v5
  • TypeScript-ready admin and server packages
  • Frontends that render Iconify names, raw SVG, or both

Installation

npm i @arshiash80/strapi-plugin-iconhub

Rebuild the admin panel after installation:

npm run build
npm run develop

Verify the plugin in Settings > Plugins.

Plugin verification

Add the field to a content type

Open Content-Type Builder, add a new custom field, and select IconHub.

Custom field tab IconHub custom field selection

The field then appears in the content entry UI like any other Strapi input.

Empty IconHub field input

Field configuration

Storage strategy

IconHub supports three storage modes:

  • iconName: store the Iconify identifier, such as mdi:home
  • iconData: store raw SVG markup
  • both: keep the identifier and SVG together for maximum flexibility

This is configured in the field settings.

Configure storage preferences

Restrict available icon set categories

In Basic Settings, you can decide which Iconify collection categories are available for this field. This is the main control for narrowing the picker to a design system, brand icon family, emoji-only field, and similar editorial use cases.

Configure available icon set categories

Editor workflow

1. Browse icon sets

The default picker state is built around icon-set discovery. Editors can browse allowed categories first, then open a set when they want a tighter visual search space.

Picker default state example 1 Picker default state example 2 Picker default state example 3

2. Refine the available sets

The discovery view supports metadata-driven filtering for common browsing patterns:

  • tag filtering
  • grid / icon height filtering
  • palette and license filtering

Filter icon sets by tag Filter icon sets by grid Filter icon sets by palette and license

3. Search globally or open a specific set

Editors can search across all allowed sets from the main toolbar, or open a single set for focused browsing and in-set search.

Google Material Icons set view

The set browser keeps the current set context visible:

  • set name and author
  • icon count
  • palette information
  • in-set category chips
  • set-local search input

4. Review different icon families

The picker works well across both monotone and multicolor sets.

Material Design icons example Fluent UI System Color icons example Emoji One icons example Stickies color icons example

5. Edit and customize the selected icon

Once an icon is selected, the field shows the chosen icon in the entry form and exposes an edit action for further adjustments.

Field input with selected icon and color Edit button on field input

The edit modal includes:

  • live preview
  • visual color picker
  • hex input
  • icon name and raw SVG editing controls
  • download actions for exported assets

Icon edit modal Visual color picker

Stored value shape

Depending on configuration, IconHub stores some or all of the following fields:

type IconFieldValue = {
  iconName: string | null;
  iconData: string | null;
  width: number | null;
  height: number | null;
  color?: string | null;
  isSvgEditable?: boolean;
  isIconNameEditable?: boolean;
};

Frontend rendering

Render from iconName

Use this when you want Iconify to resolve the icon on the frontend:

import { Icon } from '@iconify/react';

type IconValue = {
  iconName: string | null;
  width: number | null;
  height: number | null;
  color?: string | null;
};

export function IconFromName({ value }: { value: IconValue }) {
  if (!value.iconName) return null;

  return (
    <Icon
      icon={value.iconName}
      width={value.width ?? 24}
      height={value.height ?? 24}
      color={value.color ?? undefined}
    />
  );
}

Render from iconData

Use this when you want full control over the SVG and do not want runtime icon lookups:

type IconValue = {
  iconData: string | null;
  width: number | null;
  height: number | null;
  color?: string | null;
};

export function IconFromSvg({ value }: { value: IconValue }) {
  if (!value.iconData) return null;

  return (
    <svg
      width={value.width ?? 24}
      height={value.height ?? 24}
      viewBox={`0 0 ${value.width ?? 24} ${value.height ?? 24}`}
      style={{ color: value.color ?? undefined }}
      dangerouslySetInnerHTML={{ __html: value.iconData }}
    />
  );
}

Development

Useful local commands:

npm run build
npm run watch
npm run watch:link
npm run verify
npm run docs:sync-media
npm run docs:readme

Type-checking can be run directly with tsc:

npx tsc -p admin/tsconfig.json --noEmit
npx tsc -p server/tsconfig.json --noEmit

Documentation assets

Documentation images and videos are stored in assets/docs/. Update README.source.md, sync changed assets to Cloudinary, then regenerate the published README:

npm run docs:sync-media
npm run docs:readme

The Cloudinary sync script uploads only changed README assets, stores their content hashes in docs/readme-media-manifest.json, and lets README.md use Cloudinary delivery URLs for marketplace-safe media rendering. Unsynced assets fall back to jsDelivr URLs.

License

MIT

版本与发布记录

@arshiash80/strapi-plugin-iconhub 共发布 9 个版本,首次发布于 2025/03/26;过去 12 个月发布了 3 个版本。

版本发布日期距今
1.3.1latest2026/04/196 个月前
1.3.02026/04/186 个月前
1.2.02026/03/307 个月前
1.1.12025/08/121.2 年前
1.1.02025/08/121.2 年前
1.0.32025/07/081.3 年前

关于 @arshiash80/strapi-plugin-iconhub 的常见问题

@arshiash80/strapi-plugin-iconhub 是什么?

Icon picker plugin for Strapi with Iconify integration — search, select, and store icons with raw SVG for high-performance rendering.

如何安装 @arshiash80/strapi-plugin-iconhub?

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

@arshiash80/strapi-plugin-iconhub 支持 TypeScript 吗?

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

@arshiash80/strapi-plugin-iconhub 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@arshiash80/strapi-plugin-iconhub 可以商用吗?

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

@arshiash80/strapi-plugin-iconhub 的下载量有多少?

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

@arshiash80/strapi-plugin-iconhub 还在维护吗?

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