diff --git a/components/input/demo/component-token.tsx b/components/input/demo/component-token.tsx
index df2a6e7e85..58109410ca 100644
--- a/components/input/demo/component-token.tsx
+++ b/components/input/demo/component-token.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { UserOutlined } from '@ant-design/icons';
import { ConfigProvider, Input } from 'antd';
const App: React.FC = () => (
@@ -12,6 +13,9 @@ const App: React.FC = () => (
>
+
+ } />
+
>
);
diff --git a/components/input/style/token.ts b/components/input/style/token.ts
index f5f095dfec..175bc770de 100644
--- a/components/input/style/token.ts
+++ b/components/input/style/token.ts
@@ -103,7 +103,9 @@ export function initInputToken(token: AliasToken): SharedInputToken {
});
}
-export const initComponentToken = (token: AliasToken): SharedComponentToken => {
+export const initComponentToken = (
+ token: AliasToken & Partial,
+): SharedComponentToken => {
const {
controlHeight,
fontSize,
@@ -124,19 +126,26 @@ export const initComponentToken = (token: AliasToken): SharedComponentToken => {
colorErrorOutline,
colorWarningOutline,
colorBgContainer,
+ inputFontSize,
+ inputFontSizeLG,
+ inputFontSizeSM,
} = token;
+ const mergedFontSize = inputFontSize || fontSize;
+ const mergedFontSizeSM = inputFontSizeSM || mergedFontSize;
+ const mergedFontSizeLG = inputFontSizeLG || fontSizeLG;
+
return {
paddingBlock: Math.max(
- Math.round(((controlHeight - fontSize * lineHeight) / 2) * 10) / 10 - lineWidth,
+ Math.round(((controlHeight - mergedFontSize * lineHeight) / 2) * 10) / 10 - lineWidth,
0,
),
paddingBlockSM: Math.max(
- Math.round(((controlHeightSM - fontSize * lineHeight) / 2) * 10) / 10 - lineWidth,
+ Math.round(((controlHeightSM - mergedFontSizeSM * lineHeight) / 2) * 10) / 10 - lineWidth,
0,
),
paddingBlockLG:
- Math.ceil(((controlHeightLG - fontSizeLG * lineHeightLG) / 2) * 10) / 10 - lineWidth,
+ Math.ceil(((controlHeightLG - mergedFontSizeLG * lineHeightLG) / 2) * 10) / 10 - lineWidth,
paddingInline: paddingSM - lineWidth,
paddingInlineSM: controlPaddingHorizontalSM - lineWidth,
paddingInlineLG: controlPaddingHorizontal - lineWidth,
@@ -148,8 +157,8 @@ export const initComponentToken = (token: AliasToken): SharedComponentToken => {
warningActiveShadow: `0 0 0 ${controlOutlineWidth}px ${colorWarningOutline}`,
hoverBg: colorBgContainer,
activeBg: colorBgContainer,
- inputFontSize: fontSize,
- inputFontSizeLG: fontSizeLG,
- inputFontSizeSM: fontSize,
+ inputFontSize: mergedFontSize,
+ inputFontSizeLG: mergedFontSizeLG,
+ inputFontSizeSM: mergedFontSizeSM,
};
};