ant-design/components/color-picker/demo/controlled.tsx
2023-05-16 13:49:59 +08:00

12 lines
364 B
TypeScript

import { ColorPicker, theme } from 'antd';
import type { Color } from 'antd/es/color-picker';
import React, { useState } from 'react';
const Demo: React.FC = () => {
const { token } = theme.useToken();
const [color, setColor] = useState<Color | string>(token.colorPrimary);
return <ColorPicker value={color} onChange={setColor} />;
};
export default Demo;