1.0.9 • Published 3 years ago

@igloo_cloud/material-ui-color-sliders v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

A touch-friendly color picker based on Material-UI that supports both HSL and RGB color models.

Installation

Just download the library from npm.

Using npm

npm install @igloo_cloud/material-ui-color-sliders --save

Using Yarn

yarn add @igloo_cloud/material-ui-color-sliders

Usage

In order to use this library you will need to import each of the sliders separately and wrap them in either a <HSLSliderProvider /> or <RGBSliderProvider /> component.

import React from "react";
import {
  HSLSliderProvider,
  HueSlider,
  SaturationSlider,
  LightnessSlider,
} from "material-ui-color-sliders";

export default () =>
  <HSLSliderProvider>
    <HueSlider />
    <SaturationSlider />
    <LightnessSlider />
  </HSLSliderProvider>

Components requiring <HSLSliderProvider />:

  • <HueSlider />
  • <SaturationSlider />
  • <LightnessSlider />

Components requiring <RGBSliderProvider />:

  • <RedSlider />
  • <GreenSlider />
  • <BlueSlider />

Available props

HSLSliderProvider

NameTypeDefaultDescription
defaultValuesarray[0, 1, 0.5]Sets the initial value of the slider.
onChangefunc() => {}Callback function that is called when the value of one of the sliders contained in the component changes.

RGBSliderProvider

NameTypeDefaultDescription
defaultValuesarray[127, 127, 127]Sets the initial value of the slider.
onChangefunc() => {}Callback function that is called when the value of one of the sliders contained in the component changes.

RedSlider, GreenSlider, BlueSlider, HueSlider, SaturationSlider and LightnessSlider

NameTypeDefaultDescription
onChangefunc() => {}Callback function that is called when the value of the slider changes.
onChangeCommittedfunc() => {}Callback function that is called when the mouseup event is triggered.
styleobject{}Style applied to the root class of the component.

Try it out

Just clone this repository and run the following commands to open a live demo:

Using npm

cd example
npm start

Using Yarn

cd example
yarn start
1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago