Skip to content

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

TypeScript

feat(cli): add missing component showcases (#1915)

Cindy Zhang8542e057ef6f
diff --git a/packages/cli/templates/blocks/components/AppShell/AppShellShowcase.doc.mjs b/packages/cli/templates/blocks/components/AppShell/AppShellShowcase.doc.mjs
index 21e4cc6f23..1f804633a3 100644
--- a/packages/cli/templates/blocks/components/AppShell/AppShellShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/AppShell/AppShellShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 4 / 3,
isShowcase: true,
+ description:
+ 'A basic app shell with content padding.',
+ componentsUsed: ['AppShell', 'Text'],
};
diff --git a/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.doc.mjs b/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.doc.mjs
index 4873597074..703be982f6 100644
--- a/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 4 / 3,
isShowcase: true,
+ description:
+ 'Three aspect ratio containers: 1:1, 4:3, and 16:9.',
+ componentsUsed: ['AspectRatio', 'Center', 'Layout', 'Text'],
};
diff --git a/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx b/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx
index 30bcdeebe4..1c1092be17 100644
--- a/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx
+++ b/packages/cli/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx
@@ -1,22 +1,47 @@
'use client';
+import * as stylex from '@stylexjs/stylex';
import {XDSAspectRatio} from '@xds/core/AspectRatio';
+import {XDSCenter} from '@xds/core/Center';
+import {XDSHStack} from '@xds/core/Layout';
+import {XDSText} from '@xds/core/Text';
+import {colorVars, radiusVars} from '@xds/core/theme/tokens.stylex';
+
+const s = stylex.create({
+ square: {width: 120},
+ fourThree: {width: 160},
+ widescreen: {width: 200},
+ box: {
+ backgroundColor: colorVars['--color-background-muted'],
+ border: `1px solid ${colorVars['--color-border']}`,
+ borderRadius: radiusVars['--radius-container'],
+ },
+});
export default function AspectRatioShowcase() {
return (
- <XDSAspectRatio ratio={16 / 9}>
- <div
- style={{
- width: '100%',
- height: '100%',
- backgroundColor: '#e5e7eb',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- borderRadius: 8,
- }}>
- 16:9
- </div>
- </XDSAspectRatio>
+ <XDSHStack gap={4} vAlign="start">
+ <XDSAspectRatio ratio={1} xstyle={[s.square, s.box]}>
+ <XDSCenter width="100%" height="100%">
+ <XDSText type="supporting" color="secondary">
+ 1 : 1
+ </XDSText>
+ </XDSCenter>
+ </XDSAspectRatio>
+ <XDSAspectRatio ratio={4 / 3} xstyle={[s.fourThree, s.box]}>
+ <XDSCenter width="100%" height="100%">
+ <XDSText type="supporting" color="secondary">
+ 4 : 3
+ </XDSText>
+ </XDSCenter>
+ </XDSAspectRatio>
+ <XDSAspectRatio ratio={16 / 9} xstyle={[s.widescreen, s.box]}>
+ <XDSCenter width="100%" height="100%">
+ <XDSText type="supporting" color="secondary">
+ 16 : 9
+ </XDSText>
+ </XDSCenter>
+ </XDSAspectRatio>
+ </XDSHStack>
);
}
diff --git a/packages/cli/templates/blocks/components/FormLayout/FormLayoutShowcase.doc.mjs b/packages/cli/templates/blocks/components/FormLayout/FormLayoutShowcase.doc.mjs
index 9a91880ff2..38f70e384b 100644
--- a/packages/cli/templates/blocks/components/FormLayout/FormLayoutShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/FormLayout/FormLayoutShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A vertical form layout with text input fields.',
+ componentsUsed: ['FormLayout', 'TextInput'],
};
diff --git a/packages/cli/templates/blocks/components/IconButton/IconButtonShowcase.doc.mjs b/packages/cli/templates/blocks/components/IconButton/IconButtonShowcase.doc.mjs
index e9edc1b837..3ed46cc196 100644
--- a/packages/cli/templates/blocks/components/IconButton/IconButtonShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/IconButton/IconButtonShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'An icon button with a wrench icon.',
+ componentsUsed: ['IconButton', 'Icon'],
};
diff --git a/packages/cli/templates/blocks/components/Link/LinkShowcase.doc.mjs b/packages/cli/templates/blocks/components/Link/LinkShowcase.doc.mjs
index 778d563b0f..40b9c75225 100644
--- a/packages/cli/templates/blocks/components/Link/LinkShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Link/LinkShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A standalone link.',
+ componentsUsed: ['Link'],
};
diff --git a/packages/cli/templates/blocks/components/Markdown/MarkdownShowcase.doc.mjs b/packages/cli/templates/blocks/components/Markdown/MarkdownShowcase.doc.mjs
index aad0abd572..ed4d43e524 100644
--- a/packages/cli/templates/blocks/components/Markdown/MarkdownShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Markdown/MarkdownShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'Rich markdown content with headings, lists, and formatting.',
+ componentsUsed: ['Markdown'],
};
diff --git a/packages/cli/templates/blocks/components/NumberInput/NumberInputShowcase.doc.mjs b/packages/cli/templates/blocks/components/NumberInput/NumberInputShowcase.doc.mjs
index e639372c18..57eef69595 100644
--- a/packages/cli/templates/blocks/components/NumberInput/NumberInputShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/NumberInput/NumberInputShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A number input for quantity entry.',
+ componentsUsed: ['NumberInput'],
};
diff --git a/packages/cli/templates/blocks/components/OverflowList/OverflowListShowcase.doc.mjs b/packages/cli/templates/blocks/components/OverflowList/OverflowListShowcase.doc.mjs
index c7210b0967..2a60e9eebe 100644
--- a/packages/cli/templates/blocks/components/OverflowList/OverflowListShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/OverflowList/OverflowListShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A list of buttons that collapses overflowing items into a +N indicator.',
+ componentsUsed: ['OverflowList', 'Button'],
};
diff --git a/packages/cli/templates/blocks/components/ProgressBar/ProgressBarShowcase.doc.mjs b/packages/cli/templates/blocks/components/ProgressBar/ProgressBarShowcase.doc.mjs
index 5ae35af9c2..6a29abbc01 100644
--- a/packages/cli/templates/blocks/components/ProgressBar/ProgressBarShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/ProgressBar/ProgressBarShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A progress bar filled to 60%.',
+ componentsUsed: ['ProgressBar'],
};
diff --git a/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.doc.mjs b/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.doc.mjs
new file mode 100644
index 0000000000..3b1619cdb5
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.doc.mjs
@@ -0,0 +1,11 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'Resizable',
+ description:
+ 'Horizontal resizable split with a draggable handle between two panels.',
+ isReady: true,
+ isShowcase: true,
+ aspectRatio: 16 / 9,
+ componentsUsed: ['Resizable', 'Card', 'Layout', 'Text'],
+};
diff --git a/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.tsx b/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.tsx
new file mode 100644
index 0000000000..7cdeace7b5
--- /dev/null
+++ b/packages/cli/templates/blocks/components/Resizable/ResizableShowcase.tsx
@@ -0,0 +1,55 @@
+'use client';
+
+import {useXDSResizable, XDSResizeHandle} from '@xds/core/Resizable';
+import {
+ XDSCard,
+ XDSLayout,
+ XDSLayoutContent,
+ XDSLayoutPanel,
+ XDSVStack,
+} from '@xds/core/Layout';
+import {XDSText, XDSHeading} from '@xds/core/Text';
+
+export default function ResizableShowcase() {
+ const sidebar = useXDSResizable({
+ defaultSize: 200,
+ minSizePx: 120,
+ maxSizePx: 400,
+ });
+
+ return (
+ <XDSCard variant="muted" height={280}>
+ <XDSLayout
+ height="fill"
+ start={
+ <>
+ <XDSLayoutPanel width={sidebar.size} hasDivider={false}>
+ <XDSVStack gap={2}>
+ <XDSHeading level={4}>Sidebar</XDSHeading>
+ <XDSText color="secondary">
+ {Math.round(sidebar.size)}px wide
+ </XDSText>
+ </XDSVStack>
+ </XDSLayoutPanel>
+ <XDSResizeHandle
+ direction="horizontal"
+ hasDivider
+ resizable={sidebar.props}
+ label="Resize sidebar"
+ />
+ </>
+ }
+ content={
+ <XDSLayoutContent>
+ <XDSVStack gap={2}>
+ <XDSHeading level={4}>Content</XDSHeading>
+ <XDSText color="secondary">
+ Drag the handle to resize the sidebar.
+ </XDSText>
+ </XDSVStack>
+ </XDSLayoutContent>
+ }
+ />
+ </XDSCard>
+ );
+}
diff --git a/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.doc.mjs b/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.doc.mjs
index a837a05c14..2213873431 100644
--- a/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Skeleton/SkeletonShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A skeleton loading placeholder.',
+ componentsUsed: ['Skeleton'],
};
diff --git a/packages/cli/templates/blocks/components/Slider/SliderShowcase.doc.mjs b/packages/cli/templates/blocks/components/Slider/SliderShowcase.doc.mjs
index bf93467836..4e79f98f93 100644
--- a/packages/cli/templates/blocks/components/Slider/SliderShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Slider/SliderShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A slider control set to 50%.',
+ componentsUsed: ['Slider'],
};
diff --git a/packages/cli/templates/blocks/components/Spinner/SpinnerShowcase.doc.mjs b/packages/cli/templates/blocks/components/Spinner/SpinnerShowcase.doc.mjs
index 4a1c77534b..75be2d2621 100644
--- a/packages/cli/templates/blocks/components/Spinner/SpinnerShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Spinner/SpinnerShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A large spinner indicator.',
+ componentsUsed: ['Spinner'],
};
diff --git a/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.doc.mjs b/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.doc.mjs
index 8e6db52ac3..c927ac6380 100644
--- a/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A positive status dot indicator.',
+ componentsUsed: ['StatusDot'],
};
diff --git a/packages/cli/templates/blocks/components/Switch/SwitchShowcase.doc.mjs b/packages/cli/templates/blocks/components/Switch/SwitchShowcase.doc.mjs
index 67c58c82d3..ee88a2629b 100644
--- a/packages/cli/templates/blocks/components/Switch/SwitchShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Switch/SwitchShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A toggle switch for enabling notifications.',
+ componentsUsed: ['Switch'],
};
diff --git a/packages/cli/templates/blocks/components/TextArea/TextAreaShowcase.doc.mjs b/packages/cli/templates/blocks/components/TextArea/TextAreaShowcase.doc.mjs
index fff083971b..453573b984 100644
--- a/packages/cli/templates/blocks/components/TextArea/TextAreaShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/TextArea/TextAreaShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 1,
isShowcase: true,
+ description:
+ 'A text area with placeholder text.',
+ componentsUsed: ['TextArea'],
};
diff --git a/packages/cli/templates/blocks/components/Thumbnail/ThumbnailShowcase.doc.mjs b/packages/cli/templates/blocks/components/Thumbnail/ThumbnailShowcase.doc.mjs
index 16bc19d45d..1f935ae8ba 100644
--- a/packages/cli/templates/blocks/components/Thumbnail/ThumbnailShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Thumbnail/ThumbnailShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 16 / 9,
isShowcase: true,
+ description:
+ 'A thumbnail with an image and label.',
+ componentsUsed: ['Thumbnail'],
};
diff --git a/packages/cli/templates/blocks/components/TimeInput/TimeInputShowcase.doc.mjs b/packages/cli/templates/blocks/components/TimeInput/TimeInputShowcase.doc.mjs
index 662c22d83d..504efc29f3 100644
--- a/packages/cli/templates/blocks/components/TimeInput/TimeInputShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/TimeInput/TimeInputShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 16 / 9,
isShowcase: true,
+ description:
+ 'A time input field.',
+ componentsUsed: ['TimeInput'],
};
diff --git a/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.doc.mjs b/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.doc.mjs
index 76666d75c1..8dd93da74b 100644
--- a/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.doc.mjs
@@ -5,4 +5,7 @@ export const doc = {
isReady: true,
aspectRatio: 4 / 3,
isShowcase: true,
+ description:
+ 'A tokenizer with preset tags and search source.',
+ componentsUsed: ['Tokenizer'],
};