@uiw/react-color-hue
Version:
79 lines (59 loc) • 2.21 kB
Markdown
React Color Hue
===
[](https://jaywcjlove.github.io/#/sponsor)
[](https://bundlephobia.com/package/@uiw/react-color-hue) [](https://www.npmjs.com/package/@uiw/react-color-hue) [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-color-hue/file/README.md)
Hue Component is a subcomponent of [**`@react-color`**](https://uiwjs.github.io/react-color).
<!--rehype:ignore:start-->
[](https://uiwjs.github.io/react-color/#/hue)
<!--rehype:ignore:end-->
## Install
```bash
npm i @uiw/react-color-hue
```
## Usage
```jsx mdx:preview
import React, { useState } from 'react';
import Hue from '@uiw/react-color-hue';
export default function Demo() {
const [hsva, setHsva] = useState({ h: 0, s: 0, v: 68, a: 1 });
return (
<Hue
hue={hsva.h}
onChange={(newHue) => {
setHsva({ ...hsva, ...newHue });
}}
/>
);
}
```
```jsx mdx:preview
import React, { useState } from 'react';
import Hue from '@uiw/react-color-hue';
export default function Demo() {
return (
<Hue hue={undefined} />
);
}
```
## Props
```ts
import React from 'react';
import { AlphaProps } from '@uiw/react-color-alpha';
export interface HueProps extends Omit<AlphaProps, 'hsva' | 'onChange'> {
onChange?: (newHue: {
h: number;
}) => void;
hue: number;
}
declare const Hue: React.ForwardRefExoticComponent<HueProps & React.RefAttributes<HTMLDivElement>>;
export default Hue;
```
<!--footer-dividing-->
## Contributors
As always, thanks to our amazing contributors!
<a href="https://github.com/uiwjs/react-color/graphs/contributors">
<img src="https://uiwjs.github.io/react-color/coverage/CONTRIBUTORS.svg" />
</a>
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).
## License
Licensed under the MIT License.