Skip to content

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

TypeScript

fix(templates): refine Layout blocks for Grade A rubric scores (#1624)

Cindy Zhang9a892677046e
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.doc.mjs b/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.doc.mjs
index 525d16963e..d0f0f7fbd3 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.doc.mjs
+++ b/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.doc.mjs
@@ -6,5 +6,5 @@ export const doc = {
'A card layout with header, scrollable content area, and footer with action buttons.',
isReady: true,
aspectRatio: 4 / 3,
- componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutFooter', 'Card', 'Button', 'HStack'],
+ componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutFooter', 'Card', 'Button', 'HStack', 'VStack', 'Text', 'Heading'],
};
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.tsx b/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.tsx
index 35a3b5795c..01378e8ef2 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.tsx
+++ b/packages/cli/templates/blocks/components/Layout/LayoutBasicCardLayout.tsx
@@ -6,30 +6,43 @@ import {
XDSLayoutContent,
XDSLayoutFooter,
XDSHStack,
+ XDSVStack,
} from '@xds/core/Layout';
import {XDSCard} from '@xds/core/Card';
import {XDSButton} from '@xds/core/Button';
+import {XDSHeading, XDSText} from '@xds/core/Text';
export default function LayoutBasicCardLayout() {
return (
- <XDSCard width={400} height={350}>
+ <XDSCard height={300}>
<XDSLayout
header={
<XDSLayoutHeader hasDivider>
- <div style={{fontWeight: 600, fontSize: 18}}>Card Title</div>
+ <XDSHeading level={4}>Card Title</XDSHeading>
</XDSLayoutHeader>
}
content={
<XDSLayoutContent>
- <p style={{fontSize: 14, lineHeight: 1.5, margin: 0}}>
- This is a basic card layout with a header, scrollable content
- area, and footer. The layout automatically handles padding and
- spacing between sections.
- </p>
- <br />
- <p style={{fontSize: 14, lineHeight: 1.5, margin: 0}}>
- Try scrolling this content area when it overflows.
- </p>
+ <XDSVStack gap={3}>
+ <XDSText type="body">
+ This is a basic card layout with a header, scrollable content
+ area, and footer. The layout automatically handles padding and
+ spacing between sections.
+ </XDSText>
+ <XDSText type="body">
+ When content exceeds the available height, the content area
+ scrolls independently while the header and footer stay fixed
+ in place.
+ </XDSText>
+ <XDSText type="body">
+ This pattern works well for modal dialogs, detail panels, and
+ any card where the amount of content is unpredictable.
+ </XDSText>
+ <XDSText type="body">
+ The dividers between header, content, and footer provide clear
+ visual boundaries between the fixed and scrollable regions.
+ </XDSText>
+ </XDSVStack>
</XDSLayoutContent>
}
footer={
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.doc.mjs b/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.doc.mjs
index ec852e9cc7..c7a5405de2 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.doc.mjs
+++ b/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.doc.mjs
@@ -6,5 +6,5 @@ export const doc = {
'A minimal layout with just a content area inside a card, without header or footer.',
isReady: true,
aspectRatio: 4 / 3,
- componentsUsed: ['Layout', 'LayoutContent', 'Card'],
+ componentsUsed: ['Layout', 'LayoutContent', 'Card', 'VStack', 'Text', 'Heading'],
};
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.tsx b/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.tsx
index b2b29daf19..b827929ed4 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.tsx
+++ b/packages/cli/templates/blocks/components/Layout/LayoutContentOnlyLayout.tsx
@@ -1,22 +1,23 @@
'use client';
-import {XDSLayout, XDSLayoutContent} from '@xds/core/Layout';
+import {XDSLayout, XDSLayoutContent, XDSVStack} from '@xds/core/Layout';
import {XDSCard} from '@xds/core/Card';
+import {XDSHeading, XDSText} from '@xds/core/Text';
export default function LayoutContentOnlyLayout() {
return (
- <XDSCard width={400} height={250}>
+ <XDSCard>
<XDSLayout
content={
<XDSLayoutContent>
- <div style={{fontWeight: 600, fontSize: 18, marginBottom: 12}}>
- Simple Content
- </div>
- <p style={{fontSize: 14, lineHeight: 1.5, margin: 0}}>
- A layout can have just content without header or footer. This is
- useful for simple cards or content blocks that don't need
- structured sections.
- </p>
+ <XDSVStack gap={3}>
+ <XDSHeading level={4}>Simple Content</XDSHeading>
+ <XDSText type="body">
+ A layout can have just content without header or footer. This
+ is useful for simple cards or content blocks that don&apos;t need
+ structured sections.
+ </XDSText>
+ </XDSVStack>
</XDSLayoutContent>
}
/>
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutContentWidth.doc.mjs b/packages/cli/templates/blocks/components/Layout/LayoutContentWidth.doc.mjs
new file mode 100644
index 0000000000..a72f39c6c4
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Layout/LayoutContentWidth.doc.mjs
@@ -0,0 +1,10 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'Layout — Content Width',
+ description:
+ 'A layout using contentWidth to constrain and center content while keeping dividers full-bleed.',
+ isReady: true,
+ aspectRatio: 4 / 3,
+ componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutFooter', 'Button', 'HStack', 'VStack', 'Text', 'Heading'],
+};
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutContentWidth.tsx b/packages/cli/templates/blocks/components/Layout/LayoutContentWidth.tsx
new file mode 100644
index 0000000000..1af01d21a2
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Layout/LayoutContentWidth.tsx
@@ -0,0 +1,52 @@
+'use client';
+
+import {
+ XDSLayout,
+ XDSLayoutHeader,
+ XDSLayoutContent,
+ XDSLayoutFooter,
+ XDSHStack,
+ XDSVStack,
+} from '@xds/core/Layout';
+import {XDSButton} from '@xds/core/Button';
+import {XDSHeading, XDSText} from '@xds/core/Text';
+
+export default function LayoutContentWidth() {
+ return (
+ <XDSLayout
+ height="fill"
+ contentWidth={360}
+ header={
+ <XDSLayoutHeader hasDivider>
+ <XDSHeading level={4}>Centered Form</XDSHeading>
+ </XDSLayoutHeader>
+ }
+ content={
+ <XDSLayoutContent>
+ <XDSVStack gap={3}>
+ <XDSText type="body">
+ The contentWidth prop constrains content to a maximum width and
+ centers it within the layout. Dividers remain full-bleed while
+ content stays narrow and readable.
+ </XDSText>
+ <XDSText type="body" color="secondary">
+ Common widths: 640 for forms, 960 for content pages.
+ </XDSText>
+ </XDSVStack>
+ </XDSLayoutContent>
+ }
+ footer={
+ <XDSLayoutFooter hasDivider>
+ <XDSHStack gap={2} hAlign="end">
+ <XDSButton label="Cancel" variant="secondary">
+ Cancel
+ </XDSButton>
+ <XDSButton label="Submit" variant="primary">
+ Submit
+ </XDSButton>
+ </XDSHStack>
+ </XDSLayoutFooter>
+ }
+ />
+ );
+}
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.doc.mjs b/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.doc.mjs
index b1473511eb..d0b064f674 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.doc.mjs
+++ b/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.doc.mjs
@@ -6,5 +6,5 @@ export const doc = {
'A file browser style layout with start panel for folders, main content for files, and end panel for details.',
isReady: true,
aspectRatio: 4 / 3,
- componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutPanel', 'Card'],
+ componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutPanel', 'Card', 'VStack', 'Text', 'Heading', 'List', 'ListItem'],
};
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.tsx b/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.tsx
index 7c159ab349..26c19d407a 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.tsx
+++ b/packages/cli/templates/blocks/components/Layout/LayoutDualPanelLayout.tsx
@@ -5,89 +5,57 @@ import {
XDSLayoutHeader,
XDSLayoutContent,
XDSLayoutPanel,
+ XDSVStack,
} from '@xds/core/Layout';
import {XDSCard} from '@xds/core/Card';
-
-const folders = [
- {label: 'Documents', active: false},
- {label: 'Projects', active: true},
- {label: 'Downloads', active: false},
-];
+import {XDSHeading, XDSText} from '@xds/core/Text';
+import {XDSList, XDSListItem} from '@xds/core/List';
export default function LayoutDualPanelLayout() {
return (
- <XDSCard width="100%" maxWidth={800} height={400}>
+ <XDSCard>
<XDSLayout
header={
<XDSLayoutHeader hasDivider>
- <div style={{fontWeight: 600, fontSize: 18}}>File Browser</div>
+ <XDSHeading level={4}>File Browser</XDSHeading>
</XDSLayoutHeader>
}
start={
<XDSLayoutPanel hasDivider>
- <div
- style={{
- fontSize: 12,
- fontWeight: 600,
- textTransform: 'uppercase',
- letterSpacing: '0.05em',
- marginBottom: 8,
- }}>
- Folders
- </div>
- {folders.map((folder) => (
- <div
- key={folder.label}
- style={{
- padding: '8px 12px',
- borderRadius: 6,
- cursor: 'pointer',
- fontSize: 14,
- ...(folder.active ? {fontWeight: 500} : {}),
- }}>
- {folder.label}
- </div>
- ))}
+ <XDSVStack gap={1}>
+ <XDSText type="label" color="secondary">
+ Folders
+ </XDSText>
+ <XDSList>
+ <XDSListItem label="Documents" />
+ <XDSListItem label="Projects" isSelected />
+ <XDSListItem label="Downloads" />
+ </XDSList>
+ </XDSVStack>
</XDSLayoutPanel>
}
content={
<XDSLayoutContent>
- <div
- style={{
- fontSize: 12,
- fontWeight: 600,
- textTransform: 'uppercase',
- letterSpacing: '0.05em',
- marginBottom: 8,
- }}>
- Files
- </div>
- <div
- style={{
- borderRadius: 8,
- padding: 16,
- fontSize: 14,
- backgroundColor: 'rgba(0,0,0,0.04)',
- }}>
- Select a folder to view its contents
- </div>
+ <XDSVStack gap={2}>
+ <XDSText type="label" color="secondary">
+ Files
+ </XDSText>
+ <XDSCard variant="muted">
+ <XDSText type="body">
+ Select a folder to view its contents
+ </XDSText>
+ </XDSCard>
+ </XDSVStack>
</XDSLayoutContent>
}
end={
<XDSLayoutPanel hasDivider>
- <div
- style={{
- fontSize: 12,
- fontWeight: 600,
- textTransform: 'uppercase',
- letterSpacing: '0.05em',
- marginBottom: 8,
- }}>
- Details
- </div>
- <p style={{fontSize: 14, lineHeight: 1.5, margin: 0}}>
- Select a file to view details
- </p>
+ <XDSVStack gap={2}>
+ <XDSText type="label" color="secondary">
+ Details
+ </XDSText>
+ <XDSText type="body">Select a file to view details</XDSText>
+ </XDSVStack>
</XDSLayoutPanel>
}
/>
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.doc.mjs b/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.doc.mjs
index 9c3cb1cb41..f295a5ee00 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.doc.mjs
+++ b/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.doc.mjs
@@ -6,5 +6,5 @@ export const doc = {
'A layout where content extends edge-to-edge with zero padding, ideal for tables or images.',
isReady: true,
aspectRatio: 4 / 3,
- componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutFooter', 'Card', 'Button', 'HStack'],
+ componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutFooter', 'Card', 'Button', 'HStack', 'Section', 'Text', 'Heading'],
};
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.tsx b/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.tsx
index b4e76f8697..13e5cb6e24 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.tsx
+++ b/packages/cli/templates/blocks/components/Layout/LayoutFullBleedContent.tsx
@@ -9,30 +9,27 @@ import {
} from '@xds/core/Layout';
import {XDSCard} from '@xds/core/Card';
import {XDSButton} from '@xds/core/Button';
+import {XDSSection} from '@xds/core/Section';
+import {XDSHeading, XDSText} from '@xds/core/Text';
export default function LayoutFullBleedContent() {
return (
- <XDSCard width={400} height={350}>
+ <XDSCard>
<XDSLayout
header={
<XDSLayoutHeader hasDivider>
- <div style={{fontWeight: 600, fontSize: 18}}>Full Bleed Example</div>
+ <XDSHeading level={4}>Full Bleed Example</XDSHeading>
</XDSLayoutHeader>
}
content={
<XDSLayoutContent padding={0}>
- <div
- style={{
- padding: 16,
- fontSize: 14,
- lineHeight: 1.5,
- minHeight: 100,
- backgroundColor: 'rgba(0,0,0,0.04)',
- }}>
- This content uses padding=0 to remove padding, allowing it to
- touch the edges. Useful for tables, images, or other
- edge-to-edge content.
- </div>
+ <XDSSection variant="wash">
+ <XDSText type="body">
+ XDSSection automatically escapes the parent container padding
+ to fill edge-to-edge. Useful for wash backgrounds, tables, or
+ images that need to span the full width.
+ </XDSText>
+ </XDSSection>
</XDSLayoutContent>
}
footer={
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutShowcase.tsx b/packages/cli/templates/blocks/components/Layout/LayoutShowcase.tsx
index 0096c83fc0..ff6dbd50de 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutShowcase.tsx
+++ b/packages/cli/templates/blocks/components/Layout/LayoutShowcase.tsx
@@ -5,41 +5,55 @@ import {
XDSLayoutHeader,
XDSLayoutContent,
XDSLayoutFooter,
+ XDSLayoutPanel,
XDSHStack,
+ XDSVStack,
} from '@xds/core/Layout';
-import {XDSCard} from '@xds/core/Card';
+import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSButton} from '@xds/core/Button';
+import {XDSBadge} from '@xds/core/Badge';
+import {XDSList, XDSListItem} from '@xds/core/List';
export default function LayoutShowcase() {
return (
- <XDSCard width={400} height={300}>
- <XDSLayout
- header={
- <XDSLayoutHeader hasDivider>
- <div style={{fontWeight: 600, fontSize: 16}}>Card Title</div>
- </XDSLayoutHeader>
- }
- content={
- <XDSLayoutContent>
- <p style={{fontSize: 14, lineHeight: 1.5, margin: 0}}>
- A basic card layout with header, scrollable content area, and
- footer with action buttons.
- </p>
- </XDSLayoutContent>
- }
- footer={
- <XDSLayoutFooter hasDivider>
- <XDSHStack gap={2} hAlign="end">
- <XDSButton label="Cancel" variant="secondary">
- Cancel
- </XDSButton>
- <XDSButton label="Save" variant="primary">
- Save
- </XDSButton>
- </XDSHStack>
- </XDSLayoutFooter>
- }
- />
- </XDSCard>
+ <XDSLayout
+ height="fill"
+ header={
+ <XDSLayoutHeader hasDivider>
+ <XDSHStack gap={2} vAlign="center">
+ <XDSHeading level={4}>Projects</XDSHeading>
+ <XDSBadge variant="info" label="3 active" />
+ </XDSHStack>
+ </XDSLayoutHeader>
+ }
+ start={
+ <XDSLayoutPanel hasDivider width={140}>
+ <XDSList>
+ <XDSListItem label="Dashboard" isSelected />
+ <XDSListItem label="Analytics" />
+ <XDSListItem label="Settings" />
+ </XDSList>
+ </XDSLayoutPanel>
+ }
+ content={
+ <XDSLayoutContent>
+ <XDSVStack gap={2}>
+ <XDSHeading level={5}>Welcome back</XDSHeading>
+ <XDSText type="body" color="secondary">
+ You have 3 active projects and 2 pending reviews.
+ </XDSText>
+ </XDSVStack>
+ </XDSLayoutContent>
+ }
+ footer={
+ <XDSLayoutFooter hasDivider>
+ <XDSHStack gap={2} hAlign="end">
+ <XDSButton label="New Project" variant="primary">
+ New Project
+ </XDSButton>
+ </XDSHStack>
+ </XDSLayoutFooter>
+ }
+ />
);
}
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.doc.mjs b/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.doc.mjs
index e7980102b3..4afc6bc93f 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.doc.mjs
+++ b/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.doc.mjs
@@ -6,5 +6,5 @@ export const doc = {
'A settings page layout with a navigation sidebar panel, content area, header, and footer.',
isReady: true,
aspectRatio: 4 / 3,
- componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutFooter', 'LayoutPanel', 'Card', 'Button', 'HStack'],
+ componentsUsed: ['Layout', 'LayoutHeader', 'LayoutContent', 'LayoutFooter', 'LayoutPanel', 'Card', 'Button', 'HStack', 'VStack', 'Text', 'Heading', 'List', 'ListItem'],
};
diff --git a/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.tsx b/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.tsx
index 6d4db888fd..a590bac971 100644
--- a/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.tsx
+++ b/packages/cli/templates/blocks/components/Layout/LayoutSidebarLayout.tsx
@@ -7,53 +7,42 @@ import {
XDSLayoutFooter,
XDSLayoutPanel,
XDSHStack,
+ XDSVStack,
} from '@xds/core/Layout';
import {XDSCard} from '@xds/core/Card';
import {XDSButton} from '@xds/core/Button';
-
-const navItems = [
- {label: 'General', active: true},
- {label: 'Account', active: false},
- {label: 'Privacy', active: false},
- {label: 'Notifications', active: false},
- {label: 'Security', active: false},
-];
+import {XDSHeading, XDSText} from '@xds/core/Text';
+import {XDSList, XDSListItem} from '@xds/core/List';
export default function LayoutSidebarLayout() {
return (
- <XDSCard width={700} height={400}>
+ <XDSCard>
<XDSLayout
header={
<XDSLayoutHeader hasDivider>
- <div style={{fontWeight: 600, fontSize: 18}}>Settings</div>
+ <XDSHeading level={4}>Settings</XDSHeading>
</XDSLayoutHeader>
}
start={
- <XDSLayoutPanel hasDivider role="navigation">
- {navItems.map((item) => (
- <div
- key={item.label}
- style={{
- padding: '8px 12px',
- borderRadius: 6,
- cursor: 'pointer',
- fontSize: 14,
- ...(item.active ? {fontWeight: 500} : {}),
- }}>
- {item.label}
- </div>
- ))}
+ <XDSLayoutPanel hasDivider role="navigation" width={140}>
+ <XDSList>
+ <XDSListItem label="General" isSelected />
+ <XDSListItem label="Account" />
+ <XDSListItem label="Privacy" />
+ <XDSListItem label="Notifications" />
+ <XDSListItem label="Security" />
+ </XDSList>
</XDSLayoutPanel>
}
content={
<XDSLayoutContent>
- <div style={{fontWeight: 500, fontSize: 14, marginBottom: 12}}>
- General Settings
- </div>
- <p style={{fontSize: 14, lineHeight: 1.5, margin: 0}}>
- Configure your general preferences here. The sidebar navigation
- allows you to switch between different settings sections.
- </p>
+ <XDSVStack gap={3}>
+ <XDSHeading level={5}>General Settings</XDSHeading>
+ <XDSText type="body">
+ Configure your general preferences here. The sidebar navigation
+ allows you to switch between different settings sections.
+ </XDSText>
+ </XDSVStack>
</XDSLayoutContent>
}
footer={