1.2.0 • Published 8 months ago

react-color-chooser v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

react-color-chooser

A color picker component for React

Dependencies Dependencies

Usage

Installation

npm install react-color-chooser

Sample

import { ColorChooser } from "react-color-chooser";

function App() {
  const [color, setColor] = useState("#a349a4");

  return (
    <ColorChooser
      selectedColor={color}
      onColorSelected={setColor}
      mode={{
        predefinedColors: [
          "#000000",
          "#3f48cc",
          "#a349a4",
          "#ed1c24",
          "#fff200",
          "#22b14c",
          "#f29727",
        ],
        allowCustomColors: true,
      }}
    ></ColorChooser>
  );
}

Props

selectedColor - currently selected color\ onColorSelected - a callback called every time the selected color changes\ mode - color selection mode: predefined colors, custom colors or both\ onClose - a callback called when the picker modal is closed\ portalRootId - id of portal root element; if not specified body element is used\ className - class name of the main picker container\ disabled - when true, the button is disabled and the popup doesn't appear on click

Modes

Custom colors only

plot

Predefined colors only

plot

Both predefined and custom colors

plot

1.2.0

8 months ago

1.1.0

8 months ago

1.0.0

9 months ago

1.0.0-beta3

9 months ago

1.0.0-beta2

9 months ago

1.0.0-beta1

9 months ago