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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ui-radio

v2.0.4

Published

ui radio component with react

Downloads

26

Readme

ui-radio

NPM Download Github Download

ui-radio is a react component: for instead of html radio element, enhance disabled property and extend html radio element's properties. new properties includs:

  • datas
  • defValue
  • layout

Installation

Install the radio in your project with npm or yarn:

$ npm install ui-radio
//or
$ yarn add ui-radio

Basic Usage

use es6 import module, and then use, like this:

import Radio from 'ui-radio'
// eg1
<Radio onClick={fun} />
// eg2
<Radio onClick={fun} disabled={boolean} datas={arrayData} defValue={stringOrNumber} />

Parameters

| Name | Type | IsRequired | Description | | --------- | ------ | ---------- | ----------- | | onClick| function | yes | callback: return an object of parameter datas | | datas | array | no | such as [{name:'单选1',value:1},{name:'单选2',value:2},{name:'单选3',value:3}] | | defValue| string or number | no | datas's any value, default value is 1 | | layout| number | no | 1 show horizontal radios style, 2 show Vertical radios style |

Parameter: datas

Parameter datas have default value, like this:

[
  {
    name: '支付宝',
    value: 1,
    icon: 'alipay',
  },
  {
    name: '微信支付',
    value: 2,
    icon: 'wechat',
  },
  {
    name: '对公转账',
    value: 3,
    spaceRight: '0',
  }
]

when you fill datds parameter with your data, radio component render a new radios group. datds parameter is an array, every array element is an object. If you create a simple radio group, an object includs the following properties:

| Name | Type | IsRequired | Description | | --------- | ------ | ---------- | ----------- | | value | string or number | yes | form value data | | name | string | yes | radio name | | icon | string | no | define radio's icon img, at present, there are these values: alipay, wechat | | spaceRight | string | no | radio space between |

a simple radio group's datas, as following:

[
  {
    name: '按钮1',
    value: 's1',
  },
  {
    name: '按钮2',
    value: 's2',
  },
]

You can create a complex radio group, an object includs the following properties:

| Name | Type | IsRequired | Description | | --------- | ------ | ---------- | ----------- | | value | string or number | yes | form value data | | children | node | yes | react component or html code |

a complex radio group's datas, as following:

[
  {
    children: <div>按钮1,<span>iuiui</span></div>,
    value: 1,
  },
  {
    children: '按钮2',
    value: 2,
  },
]