1.0.7 • Published 4 years ago

material-ui-rc-color-picker-custom v1.0.7

Weekly downloads
24
License
MIT
Repository
github
Last release
4 years ago

Material UI Color Picker

Material UI React Color Picker (A fork of rc-color-picker)

npm version npm download npm dependency

Screenshots

Icon Showing Panel

Panel

Features

  • Supports color modes RGB, HSB and HSL
  • Uses the latest material-ui components

Installation

yarn add material-ui-rc-color-picker

OR

npm install material-ui-rc-color-picker

Usage

As a button which toggles the panel in a dropdown

import ColorPicker from 'material-ui-rc-color-picker';
import 'material-ui-rc-color-picker/assets/index.css';

...

<ColorPicker
  enableAlpha={false}
  color="#fafafa"
  onChange={this.onChange}
  mode="RGB" />

As a panel (No button to show. Shown directly on page)

import { Panel as ColorPickerPanel } from 'material-ui-rc-color-picker';
import 'material-ui-rc-color-picker/assets/index.css';

...

<ColorPickerPanel
  color="#fafafa"
  onChange={this.onChange}
  mode="RGB" />

Avaliable Props

ColorPicker.props

nametypedefaultdescription
alignObject: alignConfig of dom-alignpopup 's align config
alphaNumber100opacity of the color
animationStringindex.css support 'slide-up'
childrenNode<span className='react-colorpicker-trigger'></span>additional trigger appended to picker
classNameString''Aditional class to be added to component
colorString#ff0000color board current background color
defaultAlphaNumber100opacity of the color
defaultColorString#ff0000color board current background color
enableAlphaBooleantrueenable alpha controls
getCalendarContainerFunction():Elementfunction(){return document.body;}dom node where picker to be rendered into
modeStringRGBcolor mode, support mode 'RGB', 'HSB' or 'HSL'
onChangeFunctionnoopwhen select color
onCloseFunctionnoopwhen color picker popup close
onOpenFunctionnoopwhen color picker popup open
placementStringtopLeftone of 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'
transitionNameStringcss class for animation

ColorPicker.Panel.props

nametypedefaultdescription
alphaNumber100opacity of the color
classNameString''Aditional class to be added to component
colorString#ff0000color board current background color
defaultAlphaNumber100opacity of the color
defaultColorString#ff0000color board current background color
enableAlphaBooleantrueenable alpha controls
modeStringRGBcolor mode, support mode 'RGB', 'HSB' or 'HSL'
onBlurFunctionwhen picker loose focus
onChangeFunctionwhen select color trigger
onFocusFunctionwhen picker focus trigger
styleObject{}root node CSS style