JSPM

  • Created
  • Published
  • Downloads 87763
  • Score
    100M100P100Q165608F
  • License MIT

Color alpha

Package Exports

  • @uiw/react-color-alpha

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-alpha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Color Alpha

Install

npm i @uiw/react-color-alpha

Usage

import Alpha from '@uiw/react-color-alpha';

function Demo() {
  const [hsva, setHsva] = useState({ h: 0, s: 0, v: 68, a: 1 });
  return (
    <Alpha
      hsva={hsva}
      onChange={(newAlpha) => {
        setHsva({ ...hsva, ...newAlpha });
      }}
    />
  );
}

Props

import { HsvaColor } from '@uiw/color-convert';

interface ColorAlphaProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
  prefixCls?: string;
  /** @default 320px */
  width?: number;
  /** @default 16px */
  height?: number;
  /** hsva => `{ h: 0, s: 75, v: 82, a: 1 }` */
  hsva: HsvaColor;
  onChange?: (newAlpha: { a: number }) => void;
}