Skip to content

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

TypeScript

docs: add CommandPaletteEmpty preview (#3163)

David Petersenf21ada17310e
diff --git a/packages/cli/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.doc.mjs b/packages/cli/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.doc.mjs
new file mode 100644
index 0000000000..296cbf7bdf
--- /dev/null
+++ b/packages/cli/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.doc.mjs
@@ -0,0 +1,15 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ exampleFor: 'CommandPaletteEmpty',
+ name: 'CommandPaletteEmpty',
+ displayName: 'Command Palette Empty',
+ description:
+ 'Command palette empty state shown when no commands are available.',
+ isReady: true,
+ isShowcase: true,
+ aspectRatio: 4 / 3,
+ componentsUsed: ['CommandPalette', 'CommandPaletteEmpty', 'Text'],
+};
diff --git a/packages/cli/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.tsx b/packages/cli/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.tsx
new file mode 100644
index 0000000000..be68908315
--- /dev/null
+++ b/packages/cli/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.tsx
@@ -0,0 +1,26 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+'use client';
+
+import {useMemo} from 'react';
+import {CommandPalette} from '@astryxdesign/core/CommandPalette';
+import {Text} from '@astryxdesign/core/Text';
+import {createStaticSource} from '@astryxdesign/core/Typeahead';
+
+export default function CommandPaletteEmptyShowcase() {
+ const emptySource = useMemo(() => createStaticSource([]), []);
+
+ return (
+ <CommandPalette
+ isOpen
+ isInline
+ onOpenChange={() => {}}
+ searchSource={emptySource}
+ emptyBootstrapText={
+ <Text type="supporting" color="secondary">
+ No commands available yet
+ </Text>
+ }
+ />
+ );
+}