# react-awesome-selector

> A selector component built with ReactJS.

Latest version **2.0.0** (published 2021-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-awesome-selector
pnpm add react-awesome-selector
yarn add react-awesome-selector
bun add react-awesome-selector
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-04-19 |
| First published | 2019-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Mohamed Shadab |
| Maintainers | statebait |

## Links

- npm: https://www.npmjs.com/package/react-awesome-selector
- Repository: https://github.com/statebait/react-awesome-selector
- Homepage: https://github.com/statebait/react-awesome-selector#readme
- Issues: https://github.com/statebait/react-awesome-selector/issues
- npm.io page: https://npm.io/package/react-awesome-selector

## Recent versions

- 2.0.0 (latest) — 2021-04-19
- 1.1.0 — 2020-12-01
- 1.0.1 — 2020-09-12
- 1.0.0 — 2020-08-19
- 0.3.1 — 2020-08-14
- 0.3.0 — 2020-08-14
- 0.2.1 — 2020-08-13
- 0.2.0 — 2020-08-12
- 0.1.5 — 2020-06-19
- 0.1.4 — 2020-04-29
- 0.1.3 — 2019-07-16
- 0.1.2 — 2019-07-11
- 0.1.1 — 2019-06-25
- 0.1.0 — 2019-06-12

## README

# React Awesome Selector

[![npm version](https://badge.fury.io/js/react-awesome-selector.svg)](https://badge.fury.io/js/react-awesome-selector)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)

A selector component built with ReactJS.

## [Examples (Storybook)](https://statebait.github.io/react-awesome-selector)

## Getting started

To install:

```bash
npm install react-awesome-selector
```

-Or with yarn-

```bash
yarn add react-awesome-selector
```

### Usage

```jsx
import React from 'react'
import Selector from 'react-awesome-selector'
import 'react-awesome-selector/dist/style.css'

const data = [
  { name: 'card', value: 89519 },
  { name: 'array', value: 49024 },
  { name: 'grocery', value: 90170 },
  { name: 'input', value: 56963 },
]

const withCategoryData = [
  { category: 'calculate', name: 'card', value: 89519 },
  { category: 'calculate', name: 'array', value: 49024 },
  { category: 'lavender', name: 'grocery', value: 90170 },
  { category: 'lavender', name: 'input', value: 56963 },
]

export default function Main() {
  return (
    <div>
      <Selector
        data={data}
        selectTitle="Items"
        selectedTitle="Cart"
        onChange={(values) => console.log(values)}
      />
      <Selector
        data={withCategoryData}
        categorize
        selectTitle="Items"
        selectedTitle="Cart"
        onChange={(values) => console.log(values)}
      />
    </div>
  )
}
```

### Props:

```js
Selector.propTypes = {
  /**
   * Data input for the selector
   */
  data: PropTypes.array,
  /**
   * Whether to display categories in the select list
   */
  categorize: PropTypes.bool,
  /**
   * Title for the select list
   */
  selectTitle: PropTypes.string,
  /**
   * Title for the selected list
   */
  selectedTitle: PropTypes.string,
  /**
   * Function for getting the selected values when anything changes
   */
  onChange: PropTypes.func,
}

Selector.defaultProps = {
  data: [],
  categorize: false,
  selectTitle: '',
  selectedTitle: '',
  onChange: () => {},
}
```

### Styling

Use the default styles by importing:

```js
import 'react-awesome-selector/dist/style.css'
```

These classes are available for use:

```css
// Main wrapper

.react-awesome-selector-wrapper {
}

// Category

.react-awesome-selector-category {
}

.react-awesome-selector-category-title {
}

.react-awesome-selector-category-children {
}

// Selected & Select list

.react-awesome-selector-selected-list {
}

.react-awesome-selector-select-list {
}

.react-awesome-selector-select-list {
}

.react-awesome-selector-selected-list-title {
}

.react-awesome-selector-select-list-title {
}

.react-awesome-selector-selected-list-items {
}

// Item

.react-awesome-selector-item {
}

.react-awesome-selector-item-icon {
}
```

## License

This project is licensed under the MIT License - Copyright (c) 2020 Mohamed Shadab

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