Skip to content

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

TypeScript

fix(hardening): layout + structure components (#844) (#886)

Cindy Zhang20a5959edeff
diff --git a/apps/storybook/stories/AppShell.stories.tsx b/apps/storybook/stories/AppShell.stories.tsx
index c51238bfee..fa70b58b76 100644
--- a/apps/storybook/stories/AppShell.stories.tsx
+++ b/apps/storybook/stories/AppShell.stories.tsx
@@ -171,7 +171,9 @@ function SideNavWithHeader() {
<XDSSideNav
header={
<XDSSideNavHeading
- icon={<XDSIcon icon={CubeIcon} size="lg" />}
+ icon={
+ <XDSNavIcon icon={<CubeIcon style={{width: 16, height: 16}} />} />
+ }
heading="Acme App"
headingHref="#"
/>
@@ -406,7 +408,7 @@ export const FullFeatured: Story = {
icon={ChartBarIcon}
selectedIcon={ChartBarIconSolid}
href="#"
- endContent={<XDSBadge variant="info" label='New' />}
+ endContent={<XDSBadge variant="info" label="New" />}
/>
<XDSSideNavItem
label="Projects"
diff --git a/apps/storybook/stories/Card.stories.tsx b/apps/storybook/stories/Card.stories.tsx
index 6e21d94091..7d4c80782e 100644
--- a/apps/storybook/stories/Card.stories.tsx
+++ b/apps/storybook/stories/Card.stories.tsx
@@ -72,7 +72,6 @@ const meta: Meta<typeof XDSCard> = {
control: {type: 'range', min: 100, max: 600, step: 10},
description: 'Minimum height in pixels',
},
-
},
};
@@ -365,7 +364,7 @@ export const OnBackgrounds: Story = {
<XDSVStack gap={2}>
<h3 {...stylex.props(styles.text)}>Another Card</h3>
<p {...stylex.props(styles.text, styles.textSecondary)}>
- The card border and shadow provide separation from the surface.
+ The card border provides separation from the surface.
</p>
</XDSVStack>
</XDSCard>
@@ -374,3 +373,37 @@ export const OnBackgrounds: Story = {
</div>
),
};
+
+/**
+ * Callout card: a card with a wash section used as a callout/highlight area.
+ * This pattern pairs XDSCard with a wash XDSSection for visual emphasis.
+ */
+export const Callout: Story = {
+ render: () => (
+ <div {...stylex.props(styles.storyWrapper)}>
+ <XDSCard width={350}>
+ <XDSSection variant="wash">
+ <XDSVStack gap={2}>
+ <h3 {...stylex.props(styles.text)}>💡 Tip</h3>
+ <p {...stylex.props(styles.text, styles.textSecondary)}>
+ Use a wash section inside a card for callouts, tips, or
+ highlighted information. The wash background provides visual
+ contrast against the card surface.
+ </p>
+ </XDSVStack>
+ </XDSSection>
+ </XDSCard>
+ <XDSCard width={350}>
+ <XDSSection variant="wash">
+ <XDSVStack gap={2}>
+ <h3 {...stylex.props(styles.text)}>⚠️ Warning</h3>
+ <p {...stylex.props(styles.text, styles.textSecondary)}>
+ Callout cards work well for alerts and warnings too. The full
+ bleed wash fills the card edge-to-edge.
+ </p>
+ </XDSVStack>
+ </XDSSection>
+ </XDSCard>
+ </div>
+ ),
+};
diff --git a/apps/storybook/stories/Center.stories.tsx b/apps/storybook/stories/Center.stories.tsx
index 7d123c1812..f8466a9c44 100644
--- a/apps/storybook/stories/Center.stories.tsx
+++ b/apps/storybook/stories/Center.stories.tsx
@@ -75,12 +75,12 @@ type Story = StoryObj<typeof XDSCenter>;
export const Default: Story = {
args: {
axis: 'both',
- width: 300,
+ width: '100%',
height: 200,
children: null,
},
render: args => (
- <XDSSection variant="wash">
+ <XDSSection variant="wash" width="100%">
<XDSCenter {...args}>
<Box>Centered Content</Box>
</XDSCenter>
@@ -91,11 +91,11 @@ export const Default: Story = {
export const HorizontalOnly: Story = {
args: {
axis: 'horizontal',
- width: 300,
+ width: '100%',
children: null,
},
render: args => (
- <XDSSection variant="wash">
+ <XDSSection variant="wash" width="100%">
<XDSCenter {...args}>
<Box>Horizontal Center</Box>
</XDSCenter>
@@ -107,10 +107,11 @@ export const VerticalOnly: Story = {
args: {
axis: 'vertical',
height: 150,
+ width: '100%',
children: null,
},
render: args => (
- <XDSSection variant="wash">
+ <XDSSection variant="wash" width="100%">
<XDSCenter {...args}>
<Box>Vertical Center</Box>
</XDSCenter>
diff --git a/apps/storybook/stories/Section.stories.tsx b/apps/storybook/stories/Section.stories.tsx
index 751756d1ae..0ebb39fbd4 100644
--- a/apps/storybook/stories/Section.stories.tsx
+++ b/apps/storybook/stories/Section.stories.tsx
@@ -17,6 +17,10 @@ import {
} from '@xds/core/theme/tokens.stylex';
const styles = stylex.create({
+ surfaceWrapper: {
+ backgroundColor: colorVars['--color-surface'],
+ padding: spacingVars['--spacing-6'],
+ },
pageWrapper: {
backgroundColor: colorVars['--color-wash'],
padding: spacingVars['--spacing-6'],
@@ -49,7 +53,7 @@ const meta: Meta<typeof XDSSection> = {
tags: ['autodocs'],
decorators: [
Story => (
- <div {...stylex.props(styles.pageWrapper)}>
+ <div {...stylex.props(styles.surfaceWrapper)}>
<Story />
</div>
),
@@ -68,7 +72,6 @@ const meta: Meta<typeof XDSSection> = {
control: {type: 'range', min: 100, max: 600, step: 10},
description: 'Height in pixels',
},
-
},
};
diff --git a/apps/storybook/stories/Stack.stories.tsx b/apps/storybook/stories/Stack.stories.tsx
index 963c9760bf..1c9e09e485 100644
--- a/apps/storybook/stories/Stack.stories.tsx
+++ b/apps/storybook/stories/Stack.stories.tsx
@@ -221,13 +221,106 @@ export const Vertical: Story = {
// Alignment
// ============================================================================
+/**
+ * Main-axis alignment for horizontal stacks (hAlign → justify-content).
+ * Uses a wide container so the spacing differences are clearly visible.
+ */
export const HorizontalAlignments: Story = {
render: () => (
<div {...stylex.props(styles.storyWrapper)}>
<div>
- <h4 {...stylex.props(styles.heading)}>
- direction=&quot;horizontal&quot;, vAlign: start
- </h4>
+ <h4 {...stylex.props(styles.heading)}>hAlign: start (default)</h4>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ hAlign="start"
+ xstyle={[
+ styles.container,
+ styles.containerWidthLarge,
+ styles.containerPadding,
+ ]}>
+ <Box>A</Box>
+ <Box>B</Box>
+ <Box>C</Box>
+ </XDSStack>
+ </div>
+ <div>
+ <h4 {...stylex.props(styles.heading)}>hAlign: center</h4>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ hAlign="center"
+ xstyle={[
+ styles.container,
+ styles.containerWidthLarge,
+ styles.containerPadding,
+ ]}>
+ <Box>A</Box>
+ <Box>B</Box>
+ <Box>C</Box>
+ </XDSStack>
+ </div>
+ <div>
+ <h4 {...stylex.props(styles.heading)}>hAlign: end</h4>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ hAlign="end"
+ xstyle={[
+ styles.container,
+ styles.containerWidthLarge,
+ styles.containerPadding,
+ ]}>
+ <Box>A</Box>
+ <Box>B</Box>
+ <Box>C</Box>
+ </XDSStack>
+ </div>
+ <div>
+ <h4 {...stylex.props(styles.heading)}>hAlign: between</h4>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ hAlign="between"
+ xstyle={[
+ styles.container,
+ styles.containerWidthLarge,
+ styles.containerPadding,
+ ]}>
+ <Box>A</Box>
+ <Box>B</Box>
+ <Box>C</Box>
+ </XDSStack>
+ </div>
+ <div>
+ <h4 {...stylex.props(styles.heading)}>hAlign: evenly</h4>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ hAlign="evenly"
+ xstyle={[
+ styles.container,
+ styles.containerWidthLarge,
+ styles.containerPadding,
+ ]}>
+ <Box>A</Box>
+ <Box>B</Box>
+ <Box>C</Box>
+ </XDSStack>
+ </div>
+ </div>
+ ),
+};
+
+/**
+ * Cross-axis alignment for horizontal stacks (vAlign → align-items).
+ * Uses items with different heights so alignment differences are visible.
+ */
+export const HorizontalCrossAxisAlignment: Story = {
+ render: () => (
+ <div {...stylex.props(styles.storyWrapper)}>
+ <div>
+ <h4 {...stylex.props(styles.heading)}>vAlign: start</h4>
<XDSStack
direction="horizontal"
gap={2}
@@ -241,9 +334,7 @@ export const HorizontalAlignments: Story = {
</XDSStack>
</div>
<div>
- <h4 {...stylex.props(styles.heading)}>
- direction=&quot;horizontal&quot;, vAlign: center
- </h4>
+ <h4 {...stylex.props(styles.heading)}>vAlign: center</h4>
<XDSStack
direction="horizontal"
gap={2}
@@ -257,9 +348,7 @@ export const HorizontalAlignments: Story = {
</XDSStack>
</div>
<div>
- <h4 {...stylex.props(styles.heading)}>
- direction=&quot;horizontal&quot;, vAlign: end
- </h4>
+ <h4 {...stylex.props(styles.heading)}>vAlign: end</h4>
<XDSStack
direction="horizontal"
gap={2}
@@ -273,9 +362,7 @@ export const HorizontalAlignments: Story = {
</XDSStack>
</div>
<div>
- <h4 {...stylex.props(styles.heading)}>
- direction=&quot;horizontal&quot;, vAlign: stretch (default)
- </h4>
+ <h4 {...stylex.props(styles.heading)}>vAlign: stretch (default)</h4>
<XDSStack
direction="horizontal"
gap={2}
diff --git a/packages/core/src/Card/XDSCard.tsx b/packages/core/src/Card/XDSCard.tsx
index 49afe8025c..900f413ad7 100644
--- a/packages/core/src/Card/XDSCard.tsx
+++ b/packages/core/src/Card/XDSCard.tsx
@@ -14,7 +14,7 @@
import {type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {colorVars, radiusVars, shadowVars} from '../theme/tokens.stylex';
+import {colorVars, radiusVars} from '../theme/tokens.stylex';
import {container} from '../Layout/container.stylex';
import type {SpacingToken} from '../Layout/container.stylex';
import {
@@ -32,13 +32,13 @@ const styles = stylex.create({
'--card-radius': radiusVars['--radius-3'],
backgroundColor: colorVars['--color-card'],
borderRadius: 'var(--card-radius)',
- boxShadow: shadowVars['--shadow-base'],
- // Clip content to border-radius so nested containers don\'t peek out corners
+ // No drop-shadow — matches WWW XDSCard which uses border only
overflow: 'clip',
borderWidth: 1,
borderStyle: 'solid',
borderColor: colorVars['--color-border-emphasized'],
},
+
// Inner wrapper: container padding and overflow handling
cardInner: {
height: '100%',
@@ -115,9 +115,9 @@ export interface XDSCardProps extends XDSBaseProps {
}
/**
- * A card container with shadow and themed styling.
+ * A card container with border and themed styling.
*
- * Applies card-specific appearance (background, shadow, border-radius)
+ * Applies card-specific appearance (background, border, border-radius)
* and sets CSS variables for child layout components.
*
* @compositionHint Use as a top-level container for elevated content.
diff --git a/packages/core/src/Collapsible/XDSCollapsible.tsx b/packages/core/src/Collapsible/XDSCollapsible.tsx
index 0a2bcd840a..dee5b30162 100644
--- a/packages/core/src/Collapsible/XDSCollapsible.tsx
+++ b/packages/core/src/Collapsible/XDSCollapsible.tsx
@@ -18,7 +18,6 @@
* - /apps/storybook/stories/Collapsible.stories.tsx
*/
-
import {type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import {
@@ -63,10 +62,10 @@ const styles = stylex.create({
color: colorVars['--color-icon-secondary'],
},
chevronOpen: {
- transform: 'rotate(0deg)',
+ transform: 'rotate(180deg)',
},
chevronClosed: {
- transform: 'rotate(-90deg)',
+ transform: 'rotate(0deg)',
},
// Content area
contentHidden: {