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

Color Editable Input RGBA

Usage no npm install needed!

<script type="module">
  import uiwReactColorEditableInputRgba from 'https://cdn.skypack.dev/@uiw/react-color-editable-input-rgba';
</script>

README

React Color Editable Input RGBA

npm bundle size npm version Open in unpkg

EditableInputRGBA Component is a subcomponent of @react-color.

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 React from 'react';
import { EditableInputProps } from '@uiw/react-color-editable-input';
import { HsvaColor, ColorResult } from '@uiw/color-convert';
export interface EditableInputRGBAProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
  prefixCls?: string;
  hsva: HsvaColor;
  placement?: 'top' | 'left' | 'bottom' | 'right';
  rProps?: EditableInputProps;
  gProps?: EditableInputProps;
  bProps?: EditableInputProps;
  aProps?: false | EditableInputProps;
  onChange?: (color: ColorResult) => void;
}

License

Licensed under the MIT License.