@uiw/react-color-saturation
TypeScript icon, indicating that this package has built-in type declarations

2.3.2 • Public • Published

React Color Saturation

Buy me a coffee npm bundle size npm version Open in unpkg

Saturation Component is a subcomponent of @react-color.

react-color-saturation

Install

npm i @uiw/react-color-saturation

Usage

import React, { useState } from 'react';
import Saturation from '@uiw/react-color-saturation';

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

The value of hsva does not exist

import React from 'react';
import Saturation from '@uiw/react-color-saturation';

export default function Demo() {
  return (
    <div style={{ display: 'flex', gap: 10 }}>
      <Saturation hue={122} />
      <Saturation hue={210} />
      <Saturation hue={23} />
    </div>
  );
}

Props

import React from 'react';
import { HsvaColor } from '@uiw/color-convert';
import { PointerProps } from './Pointer';
export interface SaturationProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
  prefixCls?: string;
  /** hsva => `{ h: 0, s: 75, v: 82, a: 1 }` */
  hsva?: HsvaColor;
  hue?: number;
  radius?: React.CSSProperties['borderRadius'];
  /** React Component, Custom pointer component */
  pointer?: ({ prefixCls, left, top, color }: PointerProps) => JSX.Element;
  onChange?: (newColor: HsvaColor) => void;
}
declare const Saturation: React.ForwardRefExoticComponent<SaturationProps & React.RefAttributes<HTMLDivElement>>;
export default Saturation;

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

Licensed under the MIT License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.3.2
12,477latest

Version History

VersionDownloads (Last 7 Days)Published
2.3.2
12,477
2.3.1
242
2.3.0
12,505
2.2.0
0
2.1.1
6,279
2.1.0
178
2.0.9
0
2.0.8
516
2.0.7
0
2.0.6
549
2.0.5
1,604
2.0.4
1
2.0.3
188
2.0.2
141
2.0.1
15
2.0.0
11
1.4.3
2,801
1.4.2
520
1.4.1
1
1.4.01
1.3.44
1.3.31,979
1.3.21
1.3.133
1.3.0144
1.2.40
1.2.30
1.2.250
1.2.148
1.2.00
1.1.40
1.1.35
1.1.28
1.1.1325
1.1.02
1.0.120
1.0.110
1.0.108
1.0.919
1.0.80
1.0.71
1.0.60
1.0.57
1.0.40
1.0.31
1.0.20
1.0.10
1.0.00
0.1.00
0.0.341,050
0.0.330
0.0.320
0.0.310
0.0.300
0.0.290
0.0.280
0.0.27488
0.0.260
0.0.250
0.0.240
0.0.230
0.0.220
0.0.211
0.0.201
0.0.190
0.0.180
0.0.170
0.0.160
0.0.150
0.0.140
0.0.130
0.0.120
0.0.110
0.0.100
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @uiw/react-color-saturation

Weekly Downloads

34,471

Version

2.3.2

License

MIT

Unpacked Size

17.1 kB

Total Files

12

Last publish

Collaborators

  • uiwjs
  • wcjiang