Socket
Socket
Sign inDemoInstall

@cloudflare/component-color-picker

Package Overview
Dependencies
40
Maintainers
33
Versions
536
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @cloudflare/component-color-picker

A color picker wrapper for react-color


Version published
Weekly downloads
1.8K
increased by16.9%
Maintainers
33
Created
Weekly downloads
 

Readme

Source

@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;

FAQs

Last updated on 20 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc