# @cig/select

> React Select Control

Latest version **0.0.10** (published 2020-09-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install @cig/select
pnpm add @cig/select
yarn add @cig/select
bun add @cig/select
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2020-09-10 |
| First published | 2020-03-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | z |
| Maintainers | ancf, marken, loseyear |
| Keywords | react, select, mobile |

## Links

- npm: https://www.npmjs.com/package/@cig/select
- Repository: https://github.com/cig-data/x
- Homepage: https://github.com/cig-data/x/tree/master/packages/select#readme
- Issues: https://github.com/cig-data/x/issues
- npm.io page: https://npm.io/package/@cig/select

## Dependencies (5)

- [react](https://npm.io/package/react.md) ^16.13.1
- [react-dom](https://npm.io/package/react-dom.md) ^16.13.1
- [styled-components](https://npm.io/package/styled-components.md) ^5.1.1
- [@better-scroll/core](https://npm.io/package/@better-scroll/core.md) ^2.0.1
- [@better-scroll/wheel](https://npm.io/package/@better-scroll/wheel.md) ^2.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.10 (latest) — 2020-09-10
- 0.0.9 — 2020-09-10
- 0.0.8 — 2020-09-08
- 0.0.7 — 2020-09-01
- 0.0.6 — 2020-09-01
- 0.0.5 — 2020-08-31
- 0.0.4 — 2020-08-26
- 0.0.3 — 2020-08-24
- 0.0.2 — 2020-03-19
- 0.0.1 — 2020-03-19

## README

# @cig/select
> The Select control for React.

## Installation and usage
> The easiest way to use @cig/select is to install it from npm and build it into your app with Webpack.

```js
npm i -S @cig/select
```

Then use it in your App:

```js
import React, {
  useState,
  useEffect,
} from 'react'
import Select from '@cig/select'

export default () => {
  const [show, setShow] = useState(false)
  const [value, setValue] = useState(['a', 'b', 'c', 'd', 'e', 'f'])
  /*
  const [value, setValue] = useState([
    {
      value: 'a',
    },
    {
      value: 'c',
    },
    {
      value: 'd',
    },
    {
      value: 'b',
    },
  ])
  */
  const title = '新易互动...'
  const confirmValue = '确定'
  const data = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
  /*
  const data = [
    {
      value: 'a',
      data: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],
    },
    {
      value: 'b',
      data: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],
    },
    {
      value: 'c',
      data: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],
    },
    {
      value: 'd',
      data: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'],
    },
  ]
  */

  useEffect(() => console.log(value), [value])

  return (
    <Box>
      <div
        onClick={() => setShow(!show)}
        role="button"
        onKeyUp={() => {}}
        tabIndex={0}
      >
        {show ? 'Select Hide' : 'Select Show'}
      </div>
      {
        show
          ? (
            <Select
              title={title}
              value={value}
              data={[data, data, data, data]}
              show={v => setShow(v)}
              update={v => setValue(v)}
              confirmValue={confirmValue}
              confirm={v => setValue(v)}
            />
          ) : null
      }
    </Box>
  )
}
```

## Props

| 名称 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| title | String | N | 请选择 | 标题 |
| value | Array | N | - | 默认选项 |
| data | Arrar | Y | - | 数据 |
| show | Function | N | - | 是否显示 |
| update | Function | N | - | 数据更新回调 |
| confirmValue | String | N | 确定 | 确定按钮文案 |
| confirm | Function | Y | - | 确定按钮回调 |

---
_Source: https://npm.io/package/@cig/select · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
