Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including react-input-color with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. require("react-dom/package.json"); // react-dom is a peer dependency. var reactInputColor = require("react-input-color")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-input-color v3.0.1

React input color component with hsv color picker

react-input-color

npm npm Build Status codecov styled with prettier

React input color component with hsv color picker

The color picker is inspired by the sketch color picker

screenshot

Starting from v2, this component is rewritten with emotion and it doesnot require any external css file.

Installation

npm install react-input-color --save
yarn add react-input-color

Demo

https://swiftcarrot.dev/react-input-color

Usage

The initialValue property supports 6 (#RRGGBB) and 8 (#RRGGBBAA) digits hex value.

import React from 'react';
import InputColor from 'react-input-color';

function App() {
  const [color, setColor] = React.useState({});

  return (
    <div>
      <InputColor
        initialValue="#5e72e4"
        onChange={setColor}
        placement="right"
      />
      <div
        style={{
          width: 50,
          height: 50,
          marginTop: 20,
          backgroundColor: color.rgba
        }}
      />
    </div>
  );
}

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free