@uiw/react-color-circle

Color swatch component for React.

Usage no npm install needed!

<script type="module">
  import uiwReactColorCircle from 'https://cdn.skypack.dev/@uiw/react-color-circle';
</script>

README

React Color Swatch

npm bundle size npm version Open in unpkg

Circle Component is a subcomponent of @react-color.

react-color-circle

Install

npm i @uiw/react-color-circle

Usage

import Circle from '@uiw/react-color-circle';

function Demo() {
  const [hex, setHex] = useState('#F44E3B');
  return (
    <Circle
      colors={[ '#F44E3B', '#FE9200', '#FCDC00', '#DBDF00' ]}
      color={hex}
      onChange={(color) => {
        setHex(color.hex);
      }}
    />
  );
}

Props

import React from 'react';
import { HsvaColor, ColorResult } from '@uiw/color-convert';
import { SwatchProps } from '@uiw/react-color-swatch';
export interface CircleProps extends Omit<SwatchProps, 'color' | 'onChange'> {
  color?: string | HsvaColor;
  onChange?: (color: ColorResult) => void;
}

License

Licensed under the MIT License.