JSPM

  • Created
  • Published
  • Downloads 41159
  • Score
    100M100P100Q162377F
  • License MIT

Color swatch component for React.

Package Exports

  • @uiw/react-color-circle
  • @uiw/react-color-circle/cjs/index.js
  • @uiw/react-color-circle/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@uiw/react-color-circle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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 React, { useState } from 'react';
import Circle from '@uiw/react-color-circle';

export default 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;
}
declare const Circle: React.ForwardRefExoticComponent<CircleProps & React.RefAttributes<HTMLDivElement>>;
export default Circle;

License

Licensed under the MIT License.