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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ygq-rc-tabs

v3.0.1

Published

react-tabs components

Readme

React-Tab

基于react 的标签页组件(适用于移动端)

  • 基于css-modules
  • 基于wepack打包
  • 样式灵活,可深度定制

引用方法

安装
npm install ygq-rc-tabs
或者
yarn add ygq-rc-tabs

引用
import {Nav, Panel} from 'ygq-rc-tabs'

使用

import React from 'react';
import {Nav, Panel} from '../../src/index.js';

class Demo1 extends React.Component {
  state = {activeKey: 0}
  onChange = idx => this.setState({activeKey: idx});

  render() {
    return (
      <Nav
        activeKey={this.state.activeKey}
        onChange={this.onChange}
        items={['栏目1','栏目2']}
      />
      <Panels
        activeKey={this.state.activeKey}
        showAll={false}
      >
        <div>我是栏目1</div>
        <div>我是栏目2</div>
      </Panels>
    );
  }
}

样式自定义

/* 默认动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Nav 组件样式 */
.nav-wrap {
  width: 100%;
  position: relative;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
}

.nav {
  display: block;
  line-height: 40px;
  flex: 1;
  &.active {
  }
}

/* Panels组件样式 */
.panels {
  width: 100%;
}

.panel {
  width: 100%;
  height: 100%;
  &.active {
    animation: fadeIn .8s;
  }
}

/* Tab 游标样式 */
.cursor-wrap {
  position: absolute;
  left: 0;
  bottom: 0;
  transition: transform 300ms ease-out;
}

.cursor {
  width: 100%;
  height: 2px;
  margin: auto;
  background-color: #4A86EA;
}

当前项目依赖css-modules,新建一份自己的自定义css|less文件, 比如tabstyle.less;

  • 命名需和默认样式名字保持一致
  • 如果需要全部自定义,开启组件clean属性为true,消除默认样式
import styles form './tabstyle.less';

将styles作为mergeStyle传入对应react 组件即可

API

Nav

| Properties | Descrition | Type | isRequired | Default | | --- | --- | --- | --- | --- | | activeKey | 初始化时展示的标签页 | number | no | 0 | | items | Nav标签内容 | array | yes | null | | onChange | 切换标签页的回调(回调参数为当前点击Nav的key值) | func | yes | 无 | | clean | 是否清除默认样式 | bool | no | false | | noCursor | 清除nav游标 | bool | no | false | | mergeStyle| 样式覆盖 | object(tab, tab-list, item, active, tab-panels, panel, cursor) | no | 无 |

Panel

| Properties | Descrition | Type | isRequired | Default | | --- | --- | --- | --- | --- | | activeKey | 初始化时展示的标签页 | number | no | 0 | | name | 标签的名字或展示内容 | string/node | yes | 无 | | clean | 是否清除默认样式 | bool | no | false | | showAll | 是否展示全部面板 | bool | no | true | | mergeStyle| 样式覆盖 | object(tab, tab-list, item, active, tab-panels, panel, cursor) | no | 无 |

example

https://fdt-component.github.io/rc-tabs/docs/index.html