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

@tanzhenxing/zx-tag

v1.0.4

Published

一个功能丰富的标签组件,支持多种类型、主题、尺寸,参考 Element Plus Tag 组件设计

Readme

ZX-Tag 标签组件

用于标记和选择的标签组件,提供了丰富的表现形式,参考 Element Plus Tag 组件设计。

特性

  • 🎨 多种类型:primary、success、info、warning、danger
  • 🎯 多种主题:dark、light、plain
  • 📏 多种尺寸:large、default、small
  • 🔘 支持圆形标签
  • 🚫 可关闭标签
  • ✅ 可选中标签(CheckTag)
  • 🎭 支持自定义图标
  • 🎪 支持动画效果
  • 🧩 插槽支持

组件列表

ZxTag - 基础标签

基础的标签组件,支持多种样式和功能。

ZxCheckTag - 可选中标签

可选中的标签组件,类似复选框但是按钮式的样式。

安装使用

// 导入组件
import { ZxTag, ZxCheckTag } from '@/components/zx-tag'

// 或者单独导入
import ZxTag from '@/components/zx-tag/zx-tag.vue'
import ZxCheckTag from '@/components/zx-tag/zx-check-tag.vue'

ZxTag 基础用法

基础标签

<template>
  <view class="flex gap-2">
    <zx-tag text="Primary" type="primary" />
    <zx-tag text="Success" type="success" />
    <zx-tag text="Info" type="info" />
    <zx-tag text="Warning" type="warning" />
    <zx-tag text="Danger" type="danger" />
  </view>
</template>

不同主题

<template>
  <view>
    <!-- Dark 主题 -->
    <view class="flex gap-2 mb-2">
      <zx-tag text="Dark" type="primary" effect="dark" />
      <zx-tag text="Dark" type="success" effect="dark" />
    </view>
    
    <!-- Light 主题(默认) -->
    <view class="flex gap-2 mb-2">
      <zx-tag text="Light" type="primary" effect="light" />
      <zx-tag text="Light" type="success" effect="light" />
    </view>
    
    <!-- Plain 主题 -->
    <view class="flex gap-2">
      <zx-tag text="Plain" type="primary" effect="plain" />
      <zx-tag text="Plain" type="success" effect="plain" />
    </view>
  </view>
</template>

不同尺寸

<template>
  <view class="flex gap-2">
    <zx-tag text="Large" size="large" />
    <zx-tag text="Default" size="default" />
    <zx-tag text="Small" size="small" />
  </view>
</template>

可移除标签

<template>
  <view class="flex gap-2">
    <zx-tag 
      v-for="tag in tags" 
      :key="tag.name" 
      :text="tag.name"
      :type="tag.type"
      closable 
      @close="handleClose"
    />
  </view>
</template>

<script setup>
import { ref } from 'vue'

const tags = ref([
  { name: 'Tag 1', type: 'primary' },
  { name: 'Tag 2', type: 'success' },
  { name: 'Tag 3', type: 'info' }
])

const handleClose = (index) => {
  tags.value.splice(index, 1)
}
</script>

圆形标签

<template>
  <view class="flex gap-2">
    <zx-tag text="Round" type="primary" round />
    <zx-tag text="Round" type="success" round />
    <zx-tag text="Round" type="info" round />
  </view>
</template>

带图标的标签

<template>
  <view class="flex gap-2">
    <zx-tag text="图标标签" type="primary" icon="star" />
    <zx-tag text="图片标签" type="success" icon="https://zxui.org/logo.png" />
  </view>
</template>

自定义插槽

<template>
  <zx-tag type="primary">
    <template #icon>
      <zx-icon name="heart" />
    </template>
    自定义内容
  </zx-tag>
</template>

ZxCheckTag 可选中标签

基础用法

<template>
  <view class="flex gap-2">
    <zx-check-tag v-model:checked="checked1" text="可选标签" />
    <zx-check-tag :checked="true" text="已选中" disabled />
    <zx-check-tag text="未选中" />
  </view>
</template>

<script setup>
import { ref } from 'vue'
const checked1 = ref(false)
</script>

不同类型

<template>
  <view class="flex gap-2">
    <zx-check-tag v-model:checked="checked1" text="Primary" type="primary" />
    <zx-check-tag v-model:checked="checked2" text="Success" type="success" />
    <zx-check-tag v-model:checked="checked3" text="Warning" type="warning" />
  </view>
</template>

ZxTag API

Attributes

| 属性名 | 说明 | 类型 | 可选值 | 默认值 | |--------|------|------|--------|--------| | type | 标签类型 | string | primary/success/info/warning/danger/error | primary | | effect | 主题 | string | dark/light/plain | light | | size | 标签尺寸 | string | large/default/small | default | | shape | 标签形状 | string | circle/square | square | | round | 是否为圆形 | boolean | - | false | | hit | 是否有边框描边 | boolean | - | false | | text | 标签文字 | string/number | - | - | | closable | 是否可关闭 | boolean | - | false | | disabled | 是否禁用 | boolean | - | false | | show | 是否显示 | boolean | - | true | | disableTransitions | 是否禁用动画 | boolean | - | false | | icon | 图标名称或图片路径 | string | - | - | | iconColor | 图标颜色 | string | - | - | | bgColor | 背景色 | string | - | - | | color | 文字颜色 | string | - | - | | borderColor | 边框颜色 | string | - | - | | closeColor | 关闭按钮颜色 | string | - | #C6C7CB | | name | 标识符 | string/number | - | - | | plain | 是否镂空(废弃) | boolean | - | false | | plainFill | 镂空时是否填充 | boolean | - | false |

Events

| 事件名 | 说明 | 回调参数 | |--------|------|----------| | click | 点击标签时触发 | (name) | | close | 关闭标签时触发 | (name) |

Slots

| 名称 | 说明 | |------|------| | default | 标签内容 | | icon | 自定义图标 |

ZxCheckTag API

Attributes

| 属性名 | 说明 | 类型 | 可选值 | 默认值 | |--------|------|------|--------|--------| | checked / v-model:checked | 是否选中 | boolean | - | false | | disabled | 是否禁用 | boolean | - | false | | type | 标签类型 | string | primary/success/info/warning/danger | primary | | size | 标签尺寸 | string | large/default/small | default | | text | 标签文字 | string/number | - | - | | bgColor | 背景色 | string | - | - | | color | 文字颜色 | string | - | - | | borderColor | 边框颜色 | string | - | - |

Events

| 事件名 | 说明 | 回调参数 | |--------|------|----------| | change | 选中状态改变时触发 | (checked: boolean) |

Slots

| 名称 | 说明 | |------|------| | default | 标签内容 |

更新日志

v1.1.0

  • ✨ 新增 effect 属性支持多种主题
  • ✨ 新增 round 属性支持圆形标签
  • ✨ 新增 hit 属性支持边框描边
  • ✨ 新增 disableTransitions 属性禁用动画
  • ✨ 新增 ZxCheckTag 可选中标签组件
  • 🐛 修复尺寸规范化问题
  • 🐛 修复图标颜色逻辑
  • 📖 完善文档和示例

v1.0.0

  • 🎉 初始版本发布
  • ✨ 支持基础标签功能
  • ✨ 支持可关闭标签
  • ✨ 支持自定义图标

兼容性说明

  • 支持 error 类型向 danger 的自动转换
  • 支持旧版本尺寸名称:minismallmediumdefault
  • 保留 plain 属性的向后兼容性,建议使用 effect="plain"

贡献

欢迎提交 Issue 和 Pull Request 来完善组件功能。