Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(Icon): default color to inherit so icons match parent context (#1588)

Cindy Zhange11c979ff1aa
diff --git a/packages/core/src/Icon/Icon.doc.mjs b/packages/core/src/Icon/Icon.doc.mjs
index ad646ad2e4..d966fd5a63 100644
--- a/packages/core/src/Icon/Icon.doc.mjs
+++ b/packages/core/src/Icon/Icon.doc.mjs
@@ -14,7 +14,7 @@ export const docs = {
name: 'color',
type: "'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'positive' | 'negative' | 'warning' | 'inherit'",
description: 'Color variant mapped to XDS icon color tokens.',
- default: "'primary'",
+ default: "'inherit'",
},
{
name: 'size',
@@ -52,7 +52,7 @@ export const docsZh = {
name: 'color',
type: "'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'positive' | 'negative' | 'warning' | 'inherit'",
description: '映射到 XDS 图标颜色令牌的颜色变体。',
- default: "'primary'",
+ default: "'inherit'",
},
{
name: 'size',
diff --git a/packages/core/src/Icon/XDSIcon.tsx b/packages/core/src/Icon/XDSIcon.tsx
index 984fa20e0a..bbe247b0e1 100644
--- a/packages/core/src/Icon/XDSIcon.tsx
+++ b/packages/core/src/Icon/XDSIcon.tsx
@@ -185,7 +185,7 @@ export interface XDSIconProps extends Omit<
icon: XDSIconType | XDSIconName;
/**
* The color variant of the icon.
- * @default 'primary'
+ * @default 'inherit'
*/
color?: XDSIconColor;
/**
@@ -213,7 +213,7 @@ export interface XDSIconProps extends Omit<
*/
export function XDSIcon({
icon,
- color = 'primary',
+ color = 'inherit',
size = 'md',
ref,
...props