= (props) => {
typography,
divider,
steps,
+ image,
};
const config = {
diff --git a/components/config-provider/index.zh-CN.md b/components/config-provider/index.zh-CN.md
index 2150149494..e93a1222ed 100644
--- a/components/config-provider/index.zh-CN.md
+++ b/components/config-provider/index.zh-CN.md
@@ -106,6 +106,7 @@ const {
| button | 设置 Button 组件的通用属性 | { className?: string, style?: React.CSSProperties, classNames?: { icon: string }, styles?: { icon: React.CSSProperties } } | - | 5.6.0 |
| divider | 设置 Divider 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| form | 设置 Form 组件的通用属性 | { validateMessages?: [ValidateMessages](/components/form-cn#validatemessages), requiredMark?: boolean \| `optional`, colon?: boolean, scrollToFirstError?: boolean \| [Options](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)} | - | requiredMark: 4.8.0; colon: 4.18.0; scrollToFirstError: 5.2.0 |
+| image | 设置 Image 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| input | 设置 Input 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| segmented | 设置 Segmented 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
| select | 设置 Select 组件的通用属性 | { showSearch?: boolean } | - | |
diff --git a/components/image/index.tsx b/components/image/index.tsx
index 09a58b7b1a..0f85dec960 100644
--- a/components/image/index.tsx
+++ b/components/image/index.tsx
@@ -2,9 +2,9 @@ import EyeOutlined from '@ant-design/icons/EyeOutlined';
import classNames from 'classnames';
import RcImage, { type ImageProps } from 'rc-image';
import * as React from 'react';
+import { getTransitionName } from '../_util/motion';
import { ConfigContext } from '../config-provider';
import defaultLocale from '../locale/en_US';
-import { getTransitionName } from '../_util/motion';
// CSSINJS
import PreviewGroup, { icons } from './PreviewGroup';
import useStyle from './style';
@@ -16,13 +16,16 @@ export interface CompositionImage extends React.FC
{
const Image: CompositionImage = ({
prefixCls: customizePrefixCls,
preview,
+ className,
rootClassName,
+ style,
...otherProps
}) => {
const {
getPrefixCls,
locale: contextLocale = defaultLocale,
getPopupContainer: getContextPopupContainer,
+ image,
} = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('image', customizePrefixCls);
@@ -33,6 +36,9 @@ const Image: CompositionImage = ({
const [wrapSSR, hashId] = useStyle(prefixCls);
const mergedRootClassName = classNames(rootClassName, hashId);
+
+ const mergedClassName = classNames(className, hashId, image?.className);
+
const mergedPreview = React.useMemo(() => {
if (preview === false) {
return preview;
@@ -54,11 +60,15 @@ const Image: CompositionImage = ({
};
}, [preview, imageLocale]);
+ const mergedStyle: React.CSSProperties = { ...image?.style, ...style };
+
return wrapSSR(
,
);