ant-design/components/color-picker/demo/change-completed.tsx
二货爱吃白萝卜 e7aa014c31
chore: Add type util (#46923)
* docs: init

* chore: all types

* docs: faq

* chore: fix lint
2024-01-11 15:55:58 +08:00

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;