mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
e7aa014c31
* docs: init * chore: all types * docs: faq * chore: fix lint
22 lines
526 B
TypeScript
22 lines
526 B
TypeScript
import React, { useState } from 'react';
|
|
import { App, ColorPicker } from 'antd';
|
|
import type { ColorPickerProps } from 'antd';
|
|
|
|
const Demo = () => {
|
|
const { message } = App.useApp();
|
|
const [value, setValue] = useState<ColorPickerProps['value']>('#1677ff');
|
|
return (
|
|
<App>
|
|
<ColorPicker
|
|
value={value}
|
|
onChangeComplete={(color) => {
|
|
setValue(color);
|
|
message.success(`The selected color is ${color.toHexString()}`);
|
|
}}
|
|
/>
|
|
</App>
|
|
);
|
|
};
|
|
|
|
export default Demo;
|