diff --git a/components/color-picker/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/color-picker/__tests__/__snapshots__/demo-extend.test.ts.snap
index 33e423af1f..4612f52e08 100644
--- a/components/color-picker/__tests__/__snapshots__/demo-extend.test.ts.snap
+++ b/components/color-picker/__tests__/__snapshots__/demo-extend.test.ts.snap
@@ -767,6 +767,388 @@ Array [
]
`;
+exports[`renders components/color-picker/demo/controlled.tsx extend context correctly 1`] = `
+Array [
+
,
+ ,
+]
+`;
+
exports[`renders components/color-picker/demo/disabled.tsx extend context correctly 1`] = `
Array [
`;
+exports[`renders components/color-picker/demo/controlled.tsx correctly 1`] = `
+
+`;
+
exports[`renders components/color-picker/demo/disabled.tsx correctly 1`] = `
{
- const { token } = theme.useToken();
- const [color, setColor] = useState
(token.colorPrimary);
+const Demo = () => ;
- return ;
-};
+export default Demo;
diff --git a/components/color-picker/demo/controlled.md b/components/color-picker/demo/controlled.md
new file mode 100644
index 0000000000..bb04600504
--- /dev/null
+++ b/components/color-picker/demo/controlled.md
@@ -0,0 +1,7 @@
+## zh-CN
+
+通过 `value` 和 `onChange` 设置组件为受控模式。
+
+## en-US
+
+Set the component to controlled mode.
diff --git a/components/color-picker/demo/controlled.tsx b/components/color-picker/demo/controlled.tsx
new file mode 100644
index 0000000000..eaebe080ea
--- /dev/null
+++ b/components/color-picker/demo/controlled.tsx
@@ -0,0 +1,11 @@
+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(token.colorPrimary);
+ return ;
+};
+
+export default Demo;
diff --git a/components/color-picker/demo/trigger.tsx b/components/color-picker/demo/trigger.tsx
index 3f244e8353..0136f8b481 100644
--- a/components/color-picker/demo/trigger.tsx
+++ b/components/color-picker/demo/trigger.tsx
@@ -11,17 +11,17 @@ export default () => {
[color],
);
+ const divStyle: React.CSSProperties = {
+ width: token.sizeMD,
+ height: token.sizeMD,
+ borderRadius: token.borderRadiusSM,
+ backgroundColor: bgColor,
+ };
+
return (
-
+
{bgColor}
diff --git a/components/color-picker/index.en-US.md b/components/color-picker/index.en-US.md
index 332299f0bb..f386923ebc 100644
--- a/components/color-picker/index.en-US.md
+++ b/components/color-picker/index.en-US.md
@@ -20,6 +20,7 @@ Used when the user needs to customize the color selection.
Basic Usage
+controlled mode
Disable
Clear Color
Custom Trigger
diff --git a/components/color-picker/index.zh-CN.md b/components/color-picker/index.zh-CN.md
index 8617d2fa19..76d23d3bf5 100644
--- a/components/color-picker/index.zh-CN.md
+++ b/components/color-picker/index.zh-CN.md
@@ -21,6 +21,7 @@ group:
基本使用
+受控模式
禁用
清除颜色
自定义触发器