Skip to content

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

TypeScript

hardening: component audit fixes — 2026-04-03 (#1092)

Cindy Zhangfdc3b08966f8
diff --git a/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx b/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx
index 5b42beafe1..a65dc914f4 100644
--- a/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx
+++ b/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx
@@ -15,6 +15,7 @@
import {useContext, type ReactNode, type MouseEvent} from 'react';
import * as stylex from '@stylexjs/stylex';
+import type {StyleXStyles} from '@stylexjs/stylex';
import {colorVars, spacingVars, typeScaleVars} from '../theme/tokens.stylex';
import {BreadcrumbCtx} from './XDSBreadcrumbs';
import {useXDSLinkComponent} from '../Link/useXDSLinkComponent';
@@ -58,6 +59,27 @@ export interface XDSBreadcrumbItemProps {
* Test ID for the list item.
*/
'data-testid'?: string;
+ /**
+ * StyleX styles created via `stylex.create()`. Merged with the component's
+ * base styles inside a single `stylex.props()` call for optimal deduplication.
+ *
+ * @example
+ * ```
+ * const overrides = stylex.create({ root: { marginBottom: 8 } });
+ * <Component xstyle={overrides.root} />
+ * ```
+ */
+ xstyle?: StyleXStyles;
+ /**
+ * CSS class name(s) appended to the root element.
+ * If you're using StyleX, prefer `xstyle` for optimal style deduplication.
+ */
+ className?: string;
+ /**
+ * Inline styles to apply to the root element. Spread after StyleX
+ * inline styles, so these values take priority.
+ */
+ style?: React.CSSProperties;
}
// =============================================================================
@@ -141,6 +163,9 @@ export function XDSBreadcrumbItem({
isCurrent: isCurrentProp,
startIcon,
'data-testid': testId,
+ xstyle,
+ className,
+ style,
}: XDSBreadcrumbItemProps) {
const ctx = useContext(BreadcrumbCtx);
const isCurrent = isCurrentProp ?? ctx.isAutoLast;
@@ -162,7 +187,10 @@ export function XDSBreadcrumbItem({
stylex.props(
itemStyles.root,
isSupporting ? itemStyles.supportingSize : itemStyles.defaultSize,
+ xstyle,
),
+ className,
+ style,
)}
data-testid={testId}>
<span
@@ -187,7 +215,10 @@ export function XDSBreadcrumbItem({
stylex.props(
itemStyles.root,
isSupporting ? itemStyles.supportingSize : itemStyles.defaultSize,
+ xstyle,
),
+ className,
+ style,
)}
data-testid={testId}>
<LinkComponent
diff --git a/packages/core/src/Card/XDSCard.tsx b/packages/core/src/Card/XDSCard.tsx
index 62ef5e134e..060c837968 100644
--- a/packages/core/src/Card/XDSCard.tsx
+++ b/packages/core/src/Card/XDSCard.tsx
@@ -24,7 +24,7 @@ import {
} from '../Layout/padding.stylex';
import type {SizeValue, SpacingStep} from '../utils/types';
import {xdsClassName, mergeProps} from '../utils';
-import {XDSBaseProps} from '../XDSBaseProps';
+import type {XDSBaseProps} from '../XDSBaseProps';
const styles = stylex.create({
// Outer wrapper: visual styling with clip for border-radius
@@ -66,7 +66,7 @@ const dynamicStyles = stylex.create({
export type {SizeValue} from '../utils/types';
-export interface XDSCardProps extends XDSBaseProps {
+export interface XDSCardProps extends XDSBaseProps<HTMLDivElement> {
ref?: React.Ref<HTMLDivElement>;
/**
* CSS class name(s) appended to the root element.
diff --git a/packages/core/src/Layout/XDSLayoutFooter.tsx b/packages/core/src/Layout/XDSLayoutFooter.tsx
index 97c50588f5..b039f1f3dd 100644
--- a/packages/core/src/Layout/XDSLayoutFooter.tsx
+++ b/packages/core/src/Layout/XDSLayoutFooter.tsx
@@ -1,3 +1,5 @@
+'use client';
+
/**
* @file XDSLayoutFooter.tsx
* @input Uses React StyleX
diff --git a/packages/core/src/Layout/XDSLayoutHeader.tsx b/packages/core/src/Layout/XDSLayoutHeader.tsx
index 72156aa12d..d6c152c806 100644
--- a/packages/core/src/Layout/XDSLayoutHeader.tsx
+++ b/packages/core/src/Layout/XDSLayoutHeader.tsx
@@ -1,3 +1,5 @@
+'use client';
+
/**
* @file XDSLayoutHeader.tsx
* @input Uses React StyleX