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

pingk-react-component-lib

v1.0.4

Published

A simple React + TypeScript component library built with Vite

Downloads

11

Readme

Pingk React Component Lib

一个基于 React + TypeScript + Vite 构建的轻量级组件库。

✨ 特性

  • 📦 开箱即用,支持 NPM 安装和 CDN 引入
  • 🦕 完全使用 TypeScript 编写,提供完整的类型定义
  • ⚡️ 基于 Vite 构建,支持 ESM 和 UMD 格式
  • 🎨 内置 BEM 规范的 Sass 样式

📦 安装

使用包管理器

# npm
npm install pingk-react-component-lib

# pnpm
pnpm add pingk-react-component-lib

# yarn
yarn add pingk-react-component-lib

浏览器直接引入 (CDN)

你也可以直接通过 CDN 引入 UMD 格式的文件:

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/pingk-react-component-lib/dist/index.css">

<!-- 引入依赖 -->
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>

<!-- 引入组件库 -->
<script src="https://unpkg.com/pingk-react-component-lib/dist/index.umd.cjs"></script>

🔨 快速上手

在 React 项目中使用

import { useState } from 'react';
import { MyButton, MyRadio } from 'pingk-react-component-lib';
// 如果构建工具没有自动处理 CSS注入,可能需要手动引入(视具体配置而定)
// import 'pingk-react-component-lib/dist/index.css';

function App() {
  const [radioValue, setRadioValue] = useState('1');

  return (
    <div>
      <h2>Button 示例</h2>
      <MyButton
        label="点击我"
        variant="primary"
        onClick={() => alert('Clicked!')}
      />

      <h2>Radio 示例</h2>
      <MyRadio
        label="选项 A"
        name="group1"
        value="1"
        checked={radioValue === '1'}
        onChange={(e) => setRadioValue(e.target.value)}
      />
      <MyRadio
        label="选项 B"
        name="group1"
        value="2"
        checked={radioValue === '2'}
        onChange={(e) => setRadioValue(e.target.value)}
      />
    </div>
  );
}

📚 组件文档

MyButton

基础按钮组件。

| 属性 | 类型 | 默认值 | 说明 | | :--- | :--- | :--- | :--- | | label | string | 必填 | 按钮显示的文本内容 | | variant | 'primary' \| 'default' | 'default' | 按钮样式变体 | | disabled | boolean | false | 是否禁用按钮 | | onClick | (event: React.MouseEvent) => void | - | 点击事件回调 | | ...props | React.ButtonHTMLAttributes | - | 其他原生 button 属性 |

MyRadio

单选框组件。

| 属性 | 类型 | 默认值 | 说明 | | :--- | :--- | :--- | :--- | | label | string | - | 单选框右侧的标签文本 | | checked | boolean | - | 是否选中 | | disabled | boolean | false | 是否禁用 | | onChange | (event: React.ChangeEvent) => void | - | 状态改变回调 | | ...props | React.InputHTMLAttributes | - | 其他原生 input[type="radio"] 属性 |

💻 本地开发

如果你想参与本项目开发,请参考 开发指南

# 克隆项目
git clone https://github.com/your-repo/pingk-react-component-lib.git

# 安装依赖
pnpm install

# 启动开发服务器
pnpm dev

# 运行测试
pnpm test

📄 License

MIT