JSPM

  • Created
  • Published
  • Downloads 57123
  • Score
    100M100P100Q185062F
  • License MIT

Color Editable Input

Package Exports

  • @uiw/react-color-editable-input-rgba

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-editable-input-rgba) 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 Editable Input RGBA

npm bundle size npm version Open in unpkg

react-color-editable-input-rgba

Install

npm i @uiw/react-color-editable-input-rgba

Usage

import { useState } from 'react';
import { hsvaToHex } from '@uiw/color-convert';
import EditableInputRGBA from '@uiw/react-color-editable-input-rgba';

function Demo() {
  const [hsva, setHsva] = useState({ h: 209, s: 36, v: 90, a: 1 });
  return (
    <div style={{ padding: '0 10px 0 20px' }}>
      <EditableInputRGBA
        hsva={hsva}
        onChange={(color) => {
          setHsva({ ...hsva, ...color.hsva });
        }}
      />
    </div>
  );
}

Props

import { EditableInputProps } from '@uiw/react-color-editable-input';

interface EditableInputRGBAProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
  prefixCls?: string;
  hsva: HsvaColor;
  placement?: 'top' | 'left' | 'bottom' | 'right';
  rProps?: EditableInputProps;
  gProps?: EditableInputProps;
  bProps?: EditableInputProps;
  aProps?: EditableInputProps;
  onChange?: (color: ColorResult) => void;
}

License

Licensed under the MIT License.