Giter Site home page Giter Site logo

max3a3 / react-simple-colorpicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redgoose-dev/react-simple-colorpicker

0.0 1.0 0.0 2.06 MB

Simple, composable, lightweight colorpicker for react

Home Page: https://redgoose-dev.github.io/react-simple-colorpicker/

License: MIT License

JavaScript 91.41% CSS 8.12% HTML 0.47%

react-simple-colorpicker's Introduction

React-Simple-ColorPicker

Install

Via yarn:

npm install --save github:redgoose-dev/react-simple-colorpicker
yarn add github:redgoose-dev/react-simple-colorpicker

Usage

javascript

import React from 'react';
import ReactDOM from 'react-dom';
import ColorPicker from 'react-simple-colorpicker';

class App extends React.Component {

	static defaultProps = {
		initialColor: '#ffffff'
	};

	colorPicker = null;

	constructor(props) {
		super();

		this.state = {
			color : props.initialColor
		};
	}

	render() {
		return (
			<ColorPicker
				ref={(r) => { this.colorPicker = r; }}
				color={this.state.color}
				onChange={(color) => this.setState({ color: color })}
				//paletteColors={[]}
			/>
		);
	}
}

ReactDOM.render(<App initialColor="#ffffff" />, document.querySelector("#app"));

scss

@import '~react-simple-colorpicker/src/ColorPicker/index.scss';

Props

color

  • type: String

Selected color

paletteColors

  • type: Array

Palette colors array

onChange

  • type: Function

Methods

changeColor

colorPicker.changeColor('#ff0000');

react-simple-colorpicker's People

Contributors

wickynilliams avatar redgoose-dev avatar stayradiated avatar aom avatar theludd avatar npmcdn-to-unpkg-bot avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.