@uiw/react-color
Version:
Color Picker component for React.
95 lines (81 loc) • 13.3 kB
Markdown
<div align="center">
<a title="React Color" href="https://uiwjs.github.io/react-color/">
<img src="https://user-images.githubusercontent.com/1680273/125317637-bd305800-e36b-11eb-945c-9d39f52b0b20.png" width="630" alt="@uiw/react-color" />
</a>
</div>
<!--dividing-->
<div align="center">
<a href="https://github.com/uiwjs/react-color/actions/workflows/ci.yml">
<img alt="Build & Deploy" src="https://github.com/uiwjs/react-color/actions/workflows/ci.yml/badge.svg" />
</a>
<a href="https://coveralls.io/github/uiwjs/react-color?branch=main">
<img alt="Coverage Status" src="https://coveralls.io/repos/github/uiwjs/react-color/badge.svg?branch=main" />
</a>
<a href="https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color/file/README.md">
<img alt="Open in unpkg" src="https://img.shields.io/badge/Open%20in-unpkg-blue" />
</a>
<a href="https://bundlephobia.com/package/@uiw/react-color">
<img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/@uiw/react-color" />
</a>
<a href="https://www.npmjs.com/package/@uiw/react-color">
<img alt="npm version" src="https://img.shields.io/npm/v/@uiw/react-color.svg" />
</a>
</div>
<div align="center">
<strong>react-color</strong> is a tiny color picker component for React apps.
</div>
## Getting Started
```bash
npm i @uiw/react-color
```
[](https://codesandbox.io/embed/react-color-example-rev1n?fontsize=14&hidenavigation=1&theme=dark) [](https://uiwjs.github.io/react-color/)
```jsx
import { Slider, Sketch, Material, Colorful, Compact } from '@uiw/react-color';
import { Alpha, Hue, ShadeSlider, Saturation, Interactive, hsvaToHslaString } from '@uiw/react-color';
function Demo() {
const [hex, setHex] = useState("#fff");
return (
<Sketch
style={{ marginLeft: 20 }}
color={hex}
onChange={(color) => {
setHex(color.hex);
}}
/>
);
}
```
## Packages
Package | Bundle size(gzip) | Version / unpkg
----- | ----- | ----
[`@uiw/react-color`](https://uiwjs.github.io/react-color/#getting-started) | [](https://bundlephobia.com/package/@uiw/react-color) [](https://bundlephobia.com/package/@uiw/react-color) | [](https://www.npmjs.com/package/@uiw/react-color) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color/file/README.md)
[`@uiw/react-color-sketch`](https://uiwjs.github.io/react-color/#react-color-sketch) | [](https://bundlephobia.com/package/@uiw/react-color-sketch) [](https://bundlephobia.com/package/@uiw/react-color-sketch) | [](https://www.npmjs.com/package/@uiw/react-color-sketch) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-sketch/file/README.md)
[`@uiw/react-color-slider`](https://uiwjs.github.io/react-color/#react-color-slider) | [](https://bundlephobia.com/package/@uiw/react-color-slider) [](https://bundlephobia.com/package/@uiw/react-color-slider) | [](https://www.npmjs.com/package/@uiw/react-color-slider) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-slider/file/README.md)
[`@uiw/react-color-compact`](https://uiwjs.github.io/react-color/#react-color-compact) | [](https://bundlephobia.com/package/@uiw/react-color-compact) [](https://bundlephobia.com/package/@uiw/react-color-compact) | [](https://www.npmjs.com/package/@uiw/react-color-compact) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-compact/file/README.md)
[`@uiw/react-color-material`](https://uiwjs.github.io/react-color/#react-color-material) | [](https://bundlephobia.com/package/@uiw/react-color-material) [](https://bundlephobia.com/package/@uiw/react-color-material) | [](https://www.npmjs.com/package/@uiw/react-color-material) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-material/file/README.md)
[`@uiw/react-color-colorful`](https://uiwjs.github.io/react-color/#react-color-colorful) | [](https://bundlephobia.com/package/@uiw/react-color-colorful) [](https://bundlephobia.com/package/@uiw/react-color-colorful) | [](https://www.npmjs.com/package/@uiw/react-color-colorful) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-colorful/file/README.md)
[`@uiw/react-color-saturation`](https://uiwjs.github.io/react-color/#react-color-saturation) | [](https://bundlephobia.com/package/@uiw/react-color-saturation) [](https://bundlephobia.com/package/@uiw/react-color-saturation) | [](https://www.npmjs.com/package/@uiw/react-color-saturation) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-saturation/file/README.md)
[`@uiw/react-color-hue`](https://uiwjs.github.io/react-color/#react-color-hue) | [](https://bundlephobia.com/package/@uiw/react-color-hue) [](https://bundlephobia.com/package/@uiw/react-color-hue) | [](https://www.npmjs.com/package/@uiw/react-color-hue) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-hue/file/README.md)
[`@uiw/react-color-alpha`](https://uiwjs.github.io/react-color/#react-color-alpha) | [](https://bundlephobia.com/package/@uiw/react-color-alpha) [](https://bundlephobia.com/package/@uiw/react-color-alpha) | [](https://www.npmjs.com/package/@uiw/react-color-alpha) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-alpha/file/README.md)
[`@uiw/react-color-swatch`](https://uiwjs.github.io/react-color/#@uiw/react-color-swatch) | [](https://bundlephobia.com/package/@uiw/react-color-swatch) [](https://bundlephobia.com/package/@uiw/react-color-swatch) | [](https://www.npmjs.com/package/@uiw/react-color-swatch) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-swatch/file/README.md)
[`@uiw/react-color-shade-slider`](https://uiwjs.github.io/react-color/#react-color-shade-slider) | [](https://bundlephobia.com/package/@uiw/react-color-shade-slider) [](https://bundlephobia.com/package/@uiw/react-color-shade-slider) | [](https://www.npmjs.com/package/@uiw/react-color-shade-slider) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-shade-slider/file/README.md)
[`@uiw/react-color-editable-input`](https://uiwjs.github.io/react-color/#react-color-editable-input) | [](https://bundlephobia.com/package/@uiw/react-color-editable-input) [](https://bundlephobia.com/package/@uiw/react-color-editable-input) | [](https://www.npmjs.com/package/@uiw/react-color-editable-input) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-editable-input/file/README.md)
[`@uiw/react-color-editable-input-rgba`](https://uiwjs.github.io/react-color/#react-color-editable-input-rgba) | [](https://bundlephobia.com/package/@uiw/react-color-editable-input-rgba) [](https://bundlephobia.com/package/@uiw/react-color-editable-input-rgba) | [](https://www.npmjs.com/package/@uiw/react-color-editable-input-rgba) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-editable-input-rgba/file/README.md)
[`@uiw/react-drag-event-interactive`](https://uiwjs.github.io/react-color/#react-drag-event-interactive) | [](https://bundlephobia.com/package/@uiw/react-drag-event-interactive) [](https://bundlephobia.com/package/@uiw/react-drag-event-interactive) | [](https://www.npmjs.com/package/@uiw/react-drag-event-interactive) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-drag-event-interactive/file/README.md)
[`@uiw/color-convert`](https://uiwjs.github.io/react-color/#color-convert) | [](https://bundlephobia.com/package/@uiw/color-convert) [](https://bundlephobia.com/package/@uiw/color-convert) | [](https://www.npmjs.com/package/@uiw/color-convert) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/color-convert/file/README.md)
<!--react-color-sketch-->
<!--react-color-slider-->
<!--react-color-compact-->
<!--react-color-material-->
<!--react-color-colorful-->
<!--react-color-swatch-->
<!--react-color-alpha-->
<!--react-color-hue-->
<!--react-color-saturation-->
<!--react-color-shade-slider-->
<!--react-color-editable-input-->
<!--react-color-editable-input-rgba-->
<!--react-drag-event-interactive-->
<!--color-convert-->
## License
Licensed under the MIT License.