@cloudflare/component-color-picker

A color picker wrapper for react-color

Stats

StarsIssuesVersionUpdatedCreatedSize
@cloudflare/component-color-picker
3.1.41518 days ago3 years agoMinified + gzip package size for @cloudflare/component-color-picker in KB

Readme

@cloudflare/component-color-picker

A color picker wrapper for react-color

Installation

Installation with yarn is recommended


$ yarn add @cloudflare/component-color-picker

Usage

import React from 'react';
import { ColorPicker, ColorPickerInput } from '../../src';
import { createComponent } from '@cloudflare/style-container';

const ConstrainingDiv = createComponent(
  () => ({
    width: '100px'
  }),
  'div'
);

class ColorPickerExample extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      color: 'green'
    };

    this.handleChange = this.handleChange.bind(this);
  }

  handleChange(e) {
    this.setState({ color: e.value });
  }

  render() {
    return (
      <div>
        <ColorPicker color={'#00BB77'} />
        <br />
        <ConstrainingDiv>
          <ColorPickerInput
            value={this.state.color}
            onChange={this.handleChange}
          />
        </ConstrainingDiv>
      </div>
    );
  }
}

export default ColorPickerExample;

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.