npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cd-icon-picker

v1.2.7

Published

Vue 3 icon picker supporting TDesign & RemixIcon, with custom SVG via :diy-icon.

Downloads

110

Readme

cd-icon-picker

Vue 3 图标选择器,支持 TDesign、RemixIcon 与自定义 SVG 精灵。默认中文交互,带搜索、分类与分页。

特性

  • 支持来源切换:RemixTDesign自定义
  • 支持风格切换:描边填充
  • 搜索支持字母子序列匹配(忽略大小写与连接符)
  • 自定义 SVG 通过精灵引用(<symbol>),无需单独组件注册
  • 输入展示支持两种模式:mode='text' 显示文字+图标,mode='icon' 仅图标

安装

npm i cd-icon-picker tdesign-vue-next remixicon

在应用入口注册:

import { createApp } from 'vue';
import TDesign from 'tdesign-vue-next';
import 'tdesign-vue-next/es/style/index.css';
import 'remixicon/fonts/remixicon.css';

import IconPickerPlugin from 'cd-icon-picker';

const app = createApp(App);
app.use(TDesign);
app.use(IconPickerPlugin);
app.mount('#app');

快速使用

<CdIconPicker
  v-model:type="iconType"
  v-model:value="iconValue"
  mode="text"
  width="200px"
  @change="(type, value) => { /*...*/ }"
/>
  • mode='text':输入框显示图标名称与前缀图标
  • mode='icon':仅显示图标,点击弹出选择对话框

组件属性(IconPicker)

  • type: 'remix' | 'tdesign' | 'custom' 当前来源(v-model:type
  • value: string 当前图标基础名(v-model:value
  • tdesign?: string 旧版双向绑定(可选)
  • remixicon?: string 旧版双向绑定(可选)
  • svg?: string 旧版双向绑定(可选)
  • pageSize: number = 140 每页显示数量
  • copy: boolean = false 选择后是否复制图标名到剪贴板
  • diyIcon: string[] | { prefix: string; icons: string[]; categoryMap?: Record<string, string[]> } 自定义 SVG 配置
  • placeholder: string = '选择图标' 输入框占位
  • searchPlaceholder: string = '搜索图标' 搜索框占位
  • readonly: boolean = true 输入框只读
  • categoryMap?: Record<string, string[]> 类别映射(可覆写内置)
  • mode: 'icon' | 'text' = 'text' 展示模式

事件:

  • update:typeupdate:valuechange(type, value)

自定义 SVG

推荐使用 vite-plugin-svg-icons 自动注册 src/svg-icon 目录下的 SVG 文件为精灵:

// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path';

export default defineConfig({
  plugins: [
    vue(),
    createSvgIconsPlugin({
      iconDirs: [path.resolve(process.cwd(), 'src/svg-icon')],
      symbolId: 'icon-[name]',
    }),
  ],
});

在入口注册精灵:

// main.ts
import 'virtual:svg-icons-register';

构造 diyIcon

// 自动读取文件名为 icons 列表
const files = import.meta.glob('./svg-icon/*.svg');
const icons = Object.keys(files).map(p => p.split('/').pop()!.replace('.svg',''));
const diyIcon = { prefix: 'icon', icons };

随后传入组件的 :diy-icon="diyIcon",即可在“自定义”来源下选择上述 SVG。

搜索与分类

  • 搜索采用字母子序列匹配:输入 aru 可匹配 ri-arrow-up-line/filled
  • type='remix'value 不含后缀时,会按当前风格自动补全
    • 描边:-line
    • 填充:-filled