# react-color-chooser

> A color picker component for React

Latest version **1.2.0** (published 2023-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-color-chooser
pnpm add react-color-chooser
yarn add react-color-chooser
bun add react-color-chooser
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2023-09-02 |
| First published | 2023-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 228.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dawid Pazik |
| Maintainers | dawidpazik |
| Keywords | react, color, picker, chooser, palette |

## Links

- npm: https://www.npmjs.com/package/react-color-chooser
- Repository: https://github.com/dawidpazik/react-color-chooser
- Homepage: https://github.com/dawidpazik/react-color-chooser#readme
- Issues: https://github.com/dawidpazik/react-color-chooser/issues
- npm.io page: https://npm.io/package/react-color-chooser

## Dependencies (1)

- [classnames](https://npm.io/package/classnames.md) ^2.3.2

## 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

- 1.2.0 (latest) — 2023-09-02
- 1.1.0 — 2023-08-26
- 1.0.0 — 2023-08-06
- 1.0.0-beta3 — 2023-08-05
- 1.0.0-beta2 — 2023-07-30

## README

# react-color-chooser

## A color picker component for React

![Dependencies](https://img.shields.io/badge/dependencies-1-blue)
![Dependencies](https://img.shields.io/badge/license-MIT-blue)

### Usage ###

#### Installation ####

```sh
npm install react-color-chooser
```

#### Sample ####

```typescript
import { ColorChooser } from "react-color-chooser";

function App() {
  const [color, setColor] = useState("#a349a4");

  return (
    <ColorChooser
      selectedColor={color}
      onColorSelected={setColor}
      mode={{
        predefinedColors: [
          "#000000",
          "#3f48cc",
          "#a349a4",
          "#ed1c24",
          "#fff200",
          "#22b14c",
          "#f29727",
        ],
        allowCustomColors: true,
      }}
    ></ColorChooser>
  );
}
```

#### Props ####

`selectedColor` - currently selected color\
`onColorSelected` - a callback called every time the selected color changes\
`mode` - color selection mode: predefined colors, custom colors or both\
`onClose` - a callback called when the picker modal is closed\
`portalRootId` - id of portal root element; if not specified body element is used\
`className` - class name of the main picker container\
`disabled` - when true, the button is disabled and the popup doesn't appear on click


### Modes ###

#### Custom colors only ####

![plot](./samples/modes_custom.png)

#### Predefined colors only ####

![plot](./samples/modes_predefined.png)

#### Both predefined and custom colors ####

![plot](./samples/modes_both.png)

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