An open source design system that's fully customizable and agent ready
TypeScript
feat: add isInline prop to Dialog, AlertDialog, and CommandPalette (#1676)
Cindy Zhang3ac192b70926
diff --git a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.doc.mjs b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.doc.mjsindex 11651b69ba..c2ac4d5288 100644--- a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.doc.mjs+++ b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.doc.mjs@@ -5,6 +5,6 @@ export const doc = {description:'A confirmation dialog that shows a spinner while the action runs.',isReady: true,- aspectRatio: 16 / 9,- componentsUsed: ['AlertDialog', 'Button'],+ aspectRatio: 4 / 3,+ componentsUsed: ['AlertDialog'],};diff --git a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.tsx b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.tsxindex eccf89485b..0be002479a 100644--- a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.tsx+++ b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogAsyncAction.tsx@@ -2,33 +2,24 @@import {useState} from 'react';import {XDSAlertDialog} from '@xds/core/AlertDialog';-import {XDSButton} from '@xds/core/Button';export default function AlertDialogAsyncAction() {- const [isOpen, setIsOpen] = useState(false);const [isLoading, setIsLoading] = useState(false);return (- <>- <XDSButton- label="Revoke access"- variant="destructive"- onClick={() => setIsOpen(true)}- />- <XDSAlertDialog- isOpen={isOpen}- onOpenChange={setIsOpen}- title="Revoke access?"- description="This user will immediately lose access to all shared resources."- actionLabel="Revoke"- isActionLoading={isLoading}- onAction={async () => {- setIsLoading(true);- await new Promise(r => setTimeout(r, 2000));- setIsLoading(false);- setIsOpen(false);- }}- />- </>+ <XDSAlertDialog+ isOpen+ isInline+ onOpenChange={() => {}}+ title="Revoke access?"+ description="This user will immediately lose access to all shared resources."+ actionLabel="Revoke"+ isActionLoading={isLoading}+ onAction={async () => {+ setIsLoading(true);+ await new Promise(r => setTimeout(r, 2000));+ setIsLoading(false);+ }}+ />);}diff --git a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.doc.mjs b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.doc.mjsindex 8736953e10..36ac279076 100644--- a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.doc.mjs+++ b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.doc.mjs@@ -6,6 +6,6 @@ export const doc = {'A delete button that asks the user to confirm before deleting.',isReady: true,isShowcase: true,- aspectRatio: 16 / 9,- componentsUsed: ['AlertDialog', 'Button'],+ aspectRatio: 4 / 3,+ componentsUsed: ['AlertDialog'],};diff --git a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.tsx b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.tsxindex 5836721113..421165c537 100644--- a/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.tsx+++ b/packages/cli/templates/blocks/components/AlertDialog/AlertDialogDeleteConfirmation.tsx@@ -1,26 +1,33 @@'use client';-import {useState} from 'react';-import {XDSAlertDialog} from '@xds/core/AlertDialog';-import {XDSButton} from '@xds/core/Button';+import {+ XDSAlertDialog,+ useXDSImperativeAlertDialog,+} from '@xds/core/AlertDialog';+// Remove isInline for production — alert dialogs should be modal.export default function AlertDialogDeleteConfirmation() {- const [isOpen, setIsOpen] = useState(false);+ const alert = useXDSImperativeAlertDialog();++ const alertProps = {+ title: 'Delete item?',+ description:+ 'This action cannot be undone. The item and all its data will be permanently removed.',+ actionLabel: 'Delete',+ } as const;+return (<>- <XDSButton- label="Delete item"- variant="destructive"- onClick={() => setIsOpen(true)}- /><XDSAlertDialog- isOpen={isOpen}- onOpenChange={setIsOpen}- title="Delete item?"- description="This action cannot be undone. The item and all its data will be permanently removed."- actionLabel="Delete"- onAction={() => setIsOpen(false)}+ isOpen+ isInline+ onOpenChange={() => {}}+ {...alertProps}+ onAction={() =>+ alert.show({...alertProps, onAction: () => alert.hide()})+ }/>+ {alert.element}</>);}diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.doc.mjs b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.doc.mjsindex dda291c807..b6a64f62e5 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.doc.mjs+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.doc.mjs@@ -6,5 +6,5 @@ export const doc = {'Server-side search with loading spinner and custom empty states.',isReady: true,aspectRatio: 4 / 3,- componentsUsed: ['CommandPalette', 'CommandPaletteInput', 'Button'],+ componentsUsed: ['CommandPalette', 'CommandPaletteInput'],};diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsxindex e8554f6a40..a949c78bcc 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx@@ -1,8 +1,10 @@'use client';-import {useState, useMemo} from 'react';-import {XDSCommandPalette, XDSCommandPaletteInput} from '@xds/core/CommandPalette';-import {XDSButton} from '@xds/core/Button';+import {useMemo} from 'react';+import {+ XDSCommandPalette,+ XDSCommandPaletteInput,+} from '@xds/core/CommandPalette';import type {XDSSearchSource} from '@xds/core/Typeahead';const allFiles = [@@ -14,7 +16,6 @@ const allFiles = [];export default function CommandPaletteAsyncSearch() {- const [isOpen, setIsOpen] = useState(false);const source = useMemo<XDSSearchSource>(() => ({async search(query: string) {@@ -31,16 +32,14 @@ export default function CommandPaletteAsyncSearch() {);return (- <>- <XDSButton label="Open File Search" onClick={() => setIsOpen(true)} />- <XDSCommandPalette- isOpen={isOpen}- onOpenChange={setIsOpen}- searchSource={source}- input={<XDSCommandPaletteInput placeholder="Search files..." />}- emptyBootstrapText="Type a filename to search"- emptySearchText="No files found"- />- </>+ <XDSCommandPalette+ isOpen+ isInline+ onOpenChange={() => {}}+ searchSource={source}+ input={<XDSCommandPaletteInput placeholder="Search files..." />}+ emptyBootstrapText="Type a filename to search"+ emptySearchText="No files found"+ />);}diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.doc.mjs b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.doc.mjsindex 965263a1d0..7989c21e48 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.doc.mjs+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.doc.mjs@@ -5,6 +5,6 @@ export const doc = {description:'Command palette with items grouped via auxiliaryData.group.',isReady: true,- aspectRatio: 4 / 3,- componentsUsed: ['CommandPalette', 'Button'],+ aspectRatio: 3 / 4,+ componentsUsed: ['CommandPalette'],};diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.tsx b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.tsxindex edcb445d97..a181aa8162 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.tsx+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteAutoGrouped.tsx@@ -1,12 +1,10 @@'use client';-import {useState, useMemo} from 'react';+import {useMemo} from 'react';import {XDSCommandPalette} from '@xds/core/CommandPalette';-import {XDSButton} from '@xds/core/Button';import {createStaticSource} from '@xds/core/Typeahead';export default function CommandPaletteAutoGrouped() {- const [isOpen, setIsOpen] = useState(false);const source = useMemo(() =>createStaticSource([@@ -16,30 +14,18 @@ export default function CommandPaletteAutoGrouped() {label: 'Settings',auxiliaryData: {group: 'Navigation'},},- {- id: 'profile',- label: 'Profile',- auxiliaryData: {group: 'Navigation'},- },- {- id: 'new-file',- label: 'New File',- auxiliaryData: {group: 'Actions'},- },+ {id: 'new-file', label: 'New File', auxiliaryData: {group: 'Actions'}},{id: 'save', label: 'Save', auxiliaryData: {group: 'Actions'}},- {id: 'export', label: 'Export', auxiliaryData: {group: 'Actions'}},]),[],);return (- <>- <XDSButton label="Open Grouped" onClick={() => setIsOpen(true)} />- <XDSCommandPalette- isOpen={isOpen}- onOpenChange={setIsOpen}- searchSource={source}- />- </>+ <XDSCommandPalette+ isOpen+ isInline+ onOpenChange={() => {}}+ searchSource={source}+ />);}diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.doc.mjs b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.doc.mjsindex efa9e84a26..c459107dec 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.doc.mjs+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.doc.mjs@@ -5,5 +5,5 @@ export const doc = {description: 'Command palette with a custom footer tip message.',isReady: true,aspectRatio: 4 / 3,- componentsUsed: ['CommandPalette', 'CommandPaletteFooter', 'Button', 'Text'],+ componentsUsed: ['CommandPalette', 'CommandPaletteFooter', 'Text'],};diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.tsx b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.tsxindex ca7588b8e8..bb00f02e89 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.tsx+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteCustomFooter.tsx@@ -1,16 +1,14 @@'use client';-import {useState, useMemo} from 'react';+import {useMemo} from 'react';import {XDSCommandPalette,XDSCommandPaletteFooter,} from '@xds/core/CommandPalette';-import {XDSButton} from '@xds/core/Button';import {XDSText} from '@xds/core/Text';import {createStaticSource} from '@xds/core/Typeahead';export default function CommandPaletteCustomFooter() {- const [isOpen, setIsOpen] = useState(false);const source = useMemo(() =>createStaticSource([@@ -21,18 +19,16 @@ export default function CommandPaletteCustomFooter() {);return (- <>- <XDSButton label="Open" onClick={() => setIsOpen(true)} />- <XDSCommandPalette- isOpen={isOpen}- onOpenChange={setIsOpen}- searchSource={source}- footer={- <XDSCommandPaletteFooter>- <XDSText type="supporting">Pro tip: use ⌘K to open anywhere</XDSText>- </XDSCommandPaletteFooter>- }- />- </>+ <XDSCommandPalette+ isOpen+ isInline+ onOpenChange={() => {}}+ searchSource={source}+ footer={+ <XDSCommandPaletteFooter>+ <XDSText type="supporting">Pro tip: use ⌘K to open anywhere</XDSText>+ </XDSCommandPaletteFooter>+ }+ />);}diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.doc.mjs b/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.doc.mjsindex 2cf5a05cb8..e9bbf0dee6 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.doc.mjs+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.doc.mjs@@ -6,5 +6,5 @@ export const doc = {'Single-value picker with persistent selection and check indicator.',isReady: true,aspectRatio: 4 / 3,- componentsUsed: ['CommandPalette', 'Button', 'Text', 'Icon'],+ componentsUsed: ['CommandPalette', 'Text', 'Icon'],};diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.tsx b/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.tsxindex e8d610e3a6..9eb38fd86e 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.tsx+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPalettePickerMode.tsx@@ -2,13 +2,11 @@import {useState, useMemo} from 'react';import {XDSCommandPalette} from '@xds/core/CommandPalette';-import {XDSButton} from '@xds/core/Button';import {XDSText} from '@xds/core/Text';import {XDSIcon} from '@xds/core/Icon';import {createStaticSource} from '@xds/core/Typeahead';export default function CommandPalettePickerMode() {- const [isOpen, setIsOpen] = useState(false);const [theme, setTheme] = useState('light');const source = useMemo(() =>@@ -21,26 +19,21 @@ export default function CommandPalettePickerMode() {);return (- <>- <XDSButton label={`Theme: ${theme}`} onClick={() => setIsOpen(true)} />- <XDSCommandPalette- isOpen={isOpen}- onOpenChange={setIsOpen}- searchSource={source}- value={theme}- onValueChange={v => {- setTheme(v);- setIsOpen(false);- }}- renderItem={(item, isSelected) => (- <>- <XDSText type="body" style={{flex: 1}}>- {item.label}- </XDSText>- {isSelected && <XDSIcon icon="check" size="sm" />}- </>- )}- />- </>+ <XDSCommandPalette+ isOpen+ isInline+ onOpenChange={() => {}}+ searchSource={source}+ value={theme}+ onValueChange={setTheme}+ renderItem={(item, isSelected) => (+ <>+ <XDSText type="body" style={{flex: 1}}>+ {item.label}+ </XDSText>+ {isSelected && <XDSIcon icon="check" size="sm" />}+ </>+ )}+ />);}diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.doc.mjs b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.doc.mjsindex 4943a8c28e..217a07ef1a 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.doc.mjs+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.doc.mjs@@ -5,6 +5,6 @@ export const doc = {description:'Custom item rendering with icons, keyboard shortcuts, and keyword search.',isReady: true,- aspectRatio: 4 / 3,- componentsUsed: ['CommandPalette', 'Button', 'Text', 'Kbd'],+ aspectRatio: 3 / 4,+ componentsUsed: ['CommandPalette', 'Text', 'Kbd'],};diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.tsx b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.tsxindex ce86bf2ddf..d77fff2103 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.tsx+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteRichItems.tsx@@ -1,8 +1,7 @@'use client';-import {useState, useMemo} from 'react';+import {useMemo} from 'react';import {XDSCommandPalette} from '@xds/core/CommandPalette';-import {XDSButton} from '@xds/core/Button';import {XDSText} from '@xds/core/Text';import {XDSKbd} from '@xds/core/Kbd';import {createStaticSource} from '@xds/core/Typeahead';@@ -14,11 +13,6 @@ type RichCommand = XDSSearchableItem<{}>;const commands: RichCommand[] = [- {- id: 'dashboard',- label: 'Go to Dashboard',- auxiliaryData: {group: 'Navigation'},- },{id: 'settings',label: 'Open Settings',@@ -29,11 +23,6 @@ const commands: RichCommand[] = [label: 'View Profile',auxiliaryData: {group: 'Navigation'},},- {- id: 'dark-mode',- label: 'Toggle Dark Mode',- auxiliaryData: {group: 'Actions'},- },{id: 'new-file',label: 'Create New File',@@ -47,27 +36,24 @@ const commands: RichCommand[] = [];export default function CommandPaletteRichItems() {- const [isOpen, setIsOpen] = useState(false);const source = useMemo(() => createStaticSource(commands), []);return (- <>- <XDSButton label="Open Rich Palette" onClick={() => setIsOpen(true)} />- <XDSCommandPalette- isOpen={isOpen}- onOpenChange={setIsOpen}- searchSource={source}- renderItem={(item: RichCommand) => (- <>- <XDSText type="body" style={{flex: 1}}>- {item.label}- </XDSText>- {item.auxiliaryData?.shortcut && (- <XDSKbd keys={item.auxiliaryData.shortcut} />- )}- </>- )}- />- </>+ <XDSCommandPalette+ isOpen+ isInline+ onOpenChange={() => {}}+ searchSource={source}+ renderItem={(item: RichCommand) => (+ <>+ <XDSText type="body" style={{flex: 1}}>+ {item.label}+ </XDSText>+ {item.auxiliaryData?.shortcut && (+ <XDSKbd keys={item.auxiliaryData.shortcut} />+ )}+ </>+ )}+ />);}diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.doc.mjs b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.doc.mjsindex b1c7f923b5..775ebac3e0 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.doc.mjs+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.doc.mjs@@ -6,5 +6,5 @@ export const doc = {isReady: true,aspectRatio: 1,isShowcase: true,- componentsUsed: ['CommandPalette', 'Button'],+ componentsUsed: ['CommandPalette'],};diff --git a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.tsx b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.tsxindex a3e13c6ecd..6c07244798 100644--- a/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.tsx+++ b/packages/cli/templates/blocks/components/CommandPalette/CommandPaletteShowcase.tsx@@ -1,12 +1,11 @@'use client';-import {useState, useMemo} from 'react';+import {useMemo} from 'react';import {XDSCommandPalette} from '@xds/core/CommandPalette';-import {XDSButton} from '@xds/core/Button';import {createStaticSource} from '@xds/core/Typeahead';+// Remove isInline for production — command palettes should be modal.export default function CommandPaletteShowcase() {- const [isOpen, setIsOpen] = useState(false);const source = useMemo(() =>createStaticSource([@@ -20,13 +19,11 @@ export default function CommandPaletteShowcase() {);return (- <>- <XDSButton label="Open Command Palette" onClick={() => setIsOpen(true)} />- <XDSCommandPalette- isOpen={isOpen}- onOpenChange={setIsOpen}- searchSource={source}- />- </>+ <XDSCommandPalette+ isOpen+ isInline+ onOpenChange={() => {}}+ searchSource={source}+ />);}diff --git a/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.doc.mjs b/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.doc.mjsindex 14a81417b3..5f9ce2ca51 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.doc.mjs+++ b/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.doc.mjs@@ -5,6 +5,6 @@ export const doc = {description:'Asks the user to confirm a destructive action before it happens. Use before deleting projects, removing team members, revoking API keys, or any irreversible operation.',isReady: true,- aspectRatio: 16 / 9,- componentsUsed: ['Dialog', 'Layout', 'Button', 'Text', 'Card'],+ aspectRatio: 4 / 3,+ componentsUsed: ['Dialog', 'Layout', 'Button', 'Text'],};diff --git a/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.tsx b/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.tsxindex 5ebf8c7a00..54bba39a55 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.tsx+++ b/packages/cli/templates/blocks/components/Dialog/DialogConfirmationDialog.tsx@@ -1,80 +1,65 @@'use client';-import {useState} from 'react';-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';+import {+ XDSDialog,+ XDSDialogHeader,+ useXDSImperativeDialog,+} from '@xds/core/Dialog';import {XDSLayout,XDSLayoutContent,XDSLayoutFooter,XDSHStack,- XDSVStack,} from '@xds/core/Layout';import {XDSButton} from '@xds/core/Button';import {XDSText} from '@xds/core/Text';-import {XDSCard} from '@xds/core/Card';-export default function DialogConfirmationDialog() {- const [isOpen, setIsOpen] = useState(false);+function Content({onClose}: {onClose: () => void}) {+ return (+ <XDSLayout+ header={+ <XDSDialogHeader+ title="Delete project?"+ onOpenChange={() => onClose()}+ />+ }+ content={+ <XDSLayoutContent>+ <XDSText type="body">+ This will permanently delete "Marketing Dashboard" and all+ of its data. This action cannot be undone.+ </XDSText>+ </XDSLayoutContent>+ }+ footer={+ <XDSLayoutFooter>+ <XDSHStack gap={2} hAlign="end">+ <XDSButton label="Cancel" variant="secondary" onClick={onClose} />+ <XDSButton label="Delete" variant="destructive" onClick={onClose} />+ </XDSHStack>+ </XDSLayoutFooter>+ }+ />+ );+}- const handleDelete = () => {- setIsOpen(false);- };+// Remove isInline for production — dialogs should be modal.+export default function DialogConfirmationDialog() {+ const dialog = useXDSImperativeDialog({width: 400, purpose: 'form'});return (- <XDSCard>- <XDSVStack gap={3}>- <XDSVStack gap={1}>- <XDSText type="body" weight="bold">- Marketing Dashboard- </XDSText>- <XDSText type="supporting" color="secondary">- Created Jan 12, 2026 · 14 pages · 3 collaborators- </XDSText>- </XDSVStack>- <XDSHStack gap={2}>- <XDSButton label="Edit" variant="secondary" onClick={() => {}} />- <XDSButton- label="Delete project"- variant="destructive"- onClick={() => setIsOpen(true)}- />- </XDSHStack>- </XDSVStack>+ <><XDSDialog- isOpen={isOpen}- onOpenChange={setIsOpen}+ isOpen+ isInline+ onOpenChange={() => {}}width={400}purpose="form">- <XDSLayout- header={- <XDSDialogHeader title="Delete project?" onOpenChange={setIsOpen} />- }- content={- <XDSLayoutContent>- <XDSText type="body">- This will permanently delete "Marketing Dashboard" and- all of its data. This action cannot be undone.- </XDSText>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSHStack gap={2} hAlign="end">- <XDSButton- label="Cancel"- variant="secondary"- onClick={() => setIsOpen(false)}- />- <XDSButton- label="Delete"- variant="destructive"- onClick={handleDelete}- />- </XDSHStack>- </XDSLayoutFooter>- }+ <Content+ onClose={() => dialog.show(<Content onClose={() => dialog.hide()} />)}/></XDSDialog>- </XDSCard>+ {dialog.element}+ </>);}diff --git a/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.doc.mjs b/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.doc.mjsindex ba45855c00..5d4e0ba52f 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.doc.mjs+++ b/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.doc.mjs@@ -5,6 +5,6 @@ export const doc = {description:'Collects user input without navigating away from the page. Uses purpose="form" so clicking the backdrop won\'t close it. Use for editing profiles, creating items, or updating settings inline.',isReady: true,- aspectRatio: 16 / 9,- componentsUsed: ['Dialog', 'Layout', 'Button', 'Text', 'TextInput', 'TextArea', 'Card'],+ aspectRatio: 3 / 4,+ componentsUsed: ['Dialog', 'Layout', 'Button', 'TextInput', 'TextArea'],};diff --git a/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.tsx b/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.tsxindex 2bce5bdbbb..8b92331cf5 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.tsx+++ b/packages/cli/templates/blocks/components/Dialog/DialogFormDialog.tsx@@ -1,7 +1,11 @@'use client';import {useState} from 'react';-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';+import {+ XDSDialog,+ XDSDialogHeader,+ useXDSImperativeDialog,+} from '@xds/core/Dialog';import {XDSLayout,XDSLayoutContent,@@ -10,82 +14,69 @@ import {XDSVStack,} from '@xds/core/Layout';import {XDSButton} from '@xds/core/Button';-import {XDSText} from '@xds/core/Text';import {XDSTextInput} from '@xds/core/TextInput';import {XDSTextArea} from '@xds/core/TextArea';-import {XDSCard} from '@xds/core/Card';-export default function DialogFormDialog() {- const [isOpen, setIsOpen] = useState(false);+function Content({onClose}: {onClose: () => void}) {const [name, setName] = useState('Ruby Cheung');const [bio, setBio] = useState('Design systems engineer');return (- <XDSCard>- <XDSVStack gap={3}>- <XDSVStack gap={1}>- <XDSText type="body" weight="bold">- Profile Settings- </XDSText>- <XDSText type="supporting" color="secondary">- Display name, bio, and avatar- </XDSText>- </XDSVStack>- <XDSButton- label="Edit profile"- variant="secondary"- onClick={() => setIsOpen(true)}+ <XDSLayout+ header={+ <XDSDialogHeader+ title="Edit profile"+ subtitle="Update your display name and bio"+ onOpenChange={() => onClose()}/>- </XDSVStack>+ }+ content={+ <XDSLayoutContent>+ <XDSVStack gap={4}>+ <XDSTextInput+ label="Display name"+ value={name}+ onChange={setName}+ placeholder="Enter your name"+ />+ <XDSTextArea+ label="Bio"+ value={bio}+ onChange={setBio}+ placeholder="Tell us about yourself"+ />+ </XDSVStack>+ </XDSLayoutContent>+ }+ footer={+ <XDSLayoutFooter>+ <XDSHStack gap={2} hAlign="end">+ <XDSButton label="Cancel" variant="secondary" onClick={onClose} />+ <XDSButton label="Save" variant="primary" onClick={onClose} />+ </XDSHStack>+ </XDSLayoutFooter>+ }+ />+ );+}++// Remove isInline for production — dialogs should be modal.+export default function DialogFormDialog() {+ const dialog = useXDSImperativeDialog({purpose: 'form', width: 480});++ return (+ <><XDSDialog- isOpen={isOpen}- onOpenChange={setIsOpen}+ isOpen+ isInline+ onOpenChange={() => {}}purpose="form"width={480}>- <XDSLayout- header={- <XDSDialogHeader- title="Edit profile"- subtitle="Update your display name and bio"- onOpenChange={setIsOpen}- />- }- content={- <XDSLayoutContent>- <XDSVStack gap={4}>- <XDSTextInput- label="Display name"- value={name}- onChange={setName}- placeholder="Enter your name"- />- <XDSTextArea- label="Bio"- value={bio}- onChange={setBio}- placeholder="Tell us about yourself"- />- </XDSVStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSHStack gap={2} hAlign="end">- <XDSButton- label="Cancel"- variant="secondary"- onClick={() => setIsOpen(false)}- />- <XDSButton- label="Save"- variant="primary"- onClick={() => setIsOpen(false)}- />- </XDSHStack>- </XDSLayoutFooter>- }+ <Content+ onClose={() => dialog.show(<Content onClose={() => dialog.hide()} />)}/></XDSDialog>- </XDSCard>+ {dialog.element}+ </>);}diff --git a/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.doc.mjs b/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.doc.mjsindex 051bed7d00..c3f4999d73 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.doc.mjs+++ b/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.doc.mjs@@ -5,6 +5,6 @@ export const doc = {description:'Constrains the dialog height and scrolls the body when content overflows. Use for terms and conditions, license agreements, changelogs, or any long-form content the user needs to review before accepting.',isReady: true,- aspectRatio: 16 / 9,- componentsUsed: ['Dialog', 'Layout', 'Button', 'Text', 'Card'],+ aspectRatio: 3 / 4,+ componentsUsed: ['Dialog', 'Layout', 'Button', 'Text'],};diff --git a/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.tsx b/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.tsxindex 17a1c5f064..85548c727a 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.tsx+++ b/packages/cli/templates/blocks/components/Dialog/DialogScrollingContent.tsx@@ -1,7 +1,10 @@'use client';-import {useState} from 'react';-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';+import {+ XDSDialog,+ XDSDialogHeader,+ useXDSImperativeDialog,+} from '@xds/core/Dialog';import {XDSLayout,XDSLayoutContent,@@ -11,76 +14,69 @@ import {} from '@xds/core/Layout';import {XDSButton} from '@xds/core/Button';import {XDSText} from '@xds/core/Text';-import {XDSCard} from '@xds/core/Card';const TERMS = [- 'You agree to use the service only for lawful purposes and in compliance with all applicable laws.',- 'Your account credentials are your responsibility. Notify us immediately if you suspect unauthorized access.',- 'We reserve the right to suspend accounts that violate these terms or engage in abusive behavior.',+ 'You agree to use the service only for lawful purposes and in compliance with all applicable laws and regulations in your jurisdiction.',+ 'Your account credentials are your responsibility. Notify us immediately if you suspect unauthorized access to your account.',+ 'We reserve the right to suspend accounts that violate these terms or engage in abusive behavior toward other users.','Content you upload remains your property. You grant us a license to host and display it within the service.',- 'We may update these terms at any time. Continued use after changes constitutes acceptance.',- 'The service is provided as-is without warranties. We are not liable for data loss or service interruptions.',+ 'We may update these terms at any time. Continued use after changes constitutes acceptance of the updated terms.',+ 'The service is provided as-is without warranties of any kind. We are not liable for data loss or service interruptions.','You may cancel your account at any time. Your data will be deleted within 30 days of cancellation.','Disputes will be resolved through binding arbitration in accordance with applicable regulations.',+ 'You agree not to reverse-engineer, decompile, or disassemble any part of the service or its underlying technology.',+ 'We may collect anonymized usage data to improve the service. Personal data is handled per our Privacy Policy.',+ 'Third-party integrations are governed by their own terms. We are not responsible for third-party service outages.',+ 'You are responsible for maintaining backups of your data. We provide export tools but do not guarantee data recovery.',+ 'Commercial use requires a Business plan. Free accounts are limited to personal and non-commercial projects.',+ 'We may introduce new features or discontinue existing ones with 30 days notice via email or in-app notification.',+ 'Violation of these terms may result in immediate termination of your account without prior notice or refund.',];+function Content({onClose}: {onClose: () => void}) {+ return (+ <XDSLayout+ header={+ <XDSDialogHeader+ title="Terms and Conditions"+ onOpenChange={() => onClose()}+ />+ }+ content={+ <XDSLayoutContent>+ <XDSVStack gap={3}>+ {TERMS.map((term, i) => (+ <XDSText type="body" key={i}>+ {i + 1}. {term}+ </XDSText>+ ))}+ </XDSVStack>+ </XDSLayoutContent>+ }+ footer={+ <XDSLayoutFooter>+ <XDSHStack gap={2} hAlign="end">+ <XDSButton label="Decline" variant="secondary" onClick={onClose} />+ <XDSButton label="Accept" variant="primary" onClick={onClose} />+ </XDSHStack>+ </XDSLayoutFooter>+ }+ />+ );+}++// Remove isInline for production — dialogs should be modal.export default function DialogScrollingContent() {- const [isOpen, setIsOpen] = useState(false);+ const dialog = useXDSImperativeDialog({maxHeight: '50vh'});return (- <XDSCard>- <XDSVStack gap={3}>- <XDSVStack gap={1}>- <XDSText type="body" weight="bold">- Terms and Conditions- </XDSText>- <XDSText type="supporting" color="secondary">- Last updated March 2026 · 8 clauses- </XDSText>- </XDSVStack>- <XDSButton- label="Review terms"- variant="secondary"- onClick={() => setIsOpen(true)}- />- </XDSVStack>- <XDSDialog isOpen={isOpen} onOpenChange={setIsOpen} maxHeight="50vh">- <XDSLayout- header={- <XDSDialogHeader- title="Terms and Conditions"- onOpenChange={setIsOpen}- />- }- content={- <XDSLayoutContent>- <XDSVStack gap={3}>- {TERMS.map((term, i) => (- <XDSText type="body" key={i}>- {i + 1}. {term}- </XDSText>- ))}- </XDSVStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSHStack gap={2} hAlign="end">- <XDSButton- label="Decline"- variant="secondary"- onClick={() => setIsOpen(false)}- />- <XDSButton- label="Accept"- variant="primary"- onClick={() => setIsOpen(false)}- />- </XDSHStack>- </XDSLayoutFooter>- }+ <>+ <XDSDialog isOpen isInline onOpenChange={() => {}} maxHeight={360}>+ <Content+ onClose={() => dialog.show(<Content onClose={() => dialog.hide()} />)}/></XDSDialog>- </XDSCard>+ {dialog.element}+ </>);}diff --git a/packages/cli/templates/blocks/components/Dialog/DialogShowcase.doc.mjs b/packages/cli/templates/blocks/components/Dialog/DialogShowcase.doc.mjsindex bc1043fde7..fd90fd0935 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogShowcase.doc.mjs+++ b/packages/cli/templates/blocks/components/Dialog/DialogShowcase.doc.mjs@@ -3,9 +3,9 @@ export const doc = {type: 'block',name: 'Dialog',description:- 'A button that opens a modal dialog with a header, body content, and action buttons.',+ 'Modal dialog with a header, body content, and close button.',isReady: true,isShowcase: true,aspectRatio: 16 / 9,- componentsUsed: ['Dialog', 'Button', 'Layout', 'Text'],+ componentsUsed: ['Dialog', 'Layout', 'Text'],};diff --git a/packages/cli/templates/blocks/components/Dialog/DialogShowcase.tsx b/packages/cli/templates/blocks/components/Dialog/DialogShowcase.tsxindex cf6bc857db..7ee97e60bb 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogShowcase.tsx+++ b/packages/cli/templates/blocks/components/Dialog/DialogShowcase.tsx@@ -1,57 +1,21 @@'use client';-import {useState} from 'react';import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';-import {- XDSLayout,- XDSLayoutContent,- XDSLayoutFooter,- XDSHStack,-} from '@xds/core/Layout';-import {XDSButton} from '@xds/core/Button';+import {XDSLayout, XDSLayoutContent} from '@xds/core/Layout';import {XDSText} from '@xds/core/Text';+// Remove isInline for production — dialogs should be modal.export default function DialogShowcase() {- const [isOpen, setIsOpen] = useState(false);-return (- <>- <XDSButton- label="Open dialog"- variant="secondary"- onClick={() => setIsOpen(true)}+ <XDSDialog isOpen isInline onOpenChange={() => {}}>+ <XDSLayout+ header={<XDSDialogHeader title="Modal Title" onOpenChange={() => {}} />}+ content={+ <XDSLayoutContent>+ <XDSText type="body">Dialog content goes here.</XDSText>+ </XDSLayoutContent>+ }/>- <XDSDialog isOpen={isOpen} onOpenChange={setIsOpen}>- <XDSLayout- header={- <XDSDialogHeader title="Confirm changes" onOpenChange={setIsOpen} />- }- content={- <XDSLayoutContent>- <XDSText type="body">- You have unsaved changes. Would you like to save them before- leaving?- </XDSText>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSHStack gap={2} hAlign="end">- <XDSButton- label="Discard"- variant="ghost"- onClick={() => setIsOpen(false)}- />- <XDSButton- label="Save"- variant="primary"- onClick={() => setIsOpen(false)}- />- </XDSHStack>- </XDSLayoutFooter>- }- />- </XDSDialog>- </>+ </XDSDialog>);}diff --git a/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.doc.mjs b/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.doc.mjsindex a092629894..a445c6d2b7 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.doc.mjs+++ b/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.doc.mjs@@ -5,6 +5,6 @@ export const doc = {description:'Cannot be dismissed by Escape or backdrop click — the user must explicitly choose an action. Uses purpose="required". Use for ownership transfers, legal acknowledgements, or critical decisions where skipping is not an option.',isReady: true,- aspectRatio: 16 / 9,- componentsUsed: ['Dialog', 'Layout', 'Button', 'Text', 'Card'],+ aspectRatio: 4 / 3,+ componentsUsed: ['Dialog', 'Layout', 'Button', 'Text'],};diff --git a/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.tsx b/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.tsxindex 575873da47..5eda4e9ff3 100644--- a/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.tsx+++ b/packages/cli/templates/blocks/components/Dialog/DialogWithSubtitle.tsx@@ -1,72 +1,60 @@'use client';-import {useState} from 'react';-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';+import {+ XDSDialog,+ XDSDialogHeader,+ useXDSImperativeDialog,+} from '@xds/core/Dialog';import {XDSLayout,XDSLayoutContent,XDSLayoutFooter,XDSHStack,- XDSVStack,} from '@xds/core/Layout';import {XDSButton} from '@xds/core/Button';import {XDSText} from '@xds/core/Text';-import {XDSCard} from '@xds/core/Card';+function Content({onClose}: {onClose: () => void}) {+ return (+ <XDSLayout+ header={+ <XDSDialogHeader+ title="Transfer project ownership"+ subtitle="This action requires confirmation from the new owner"+ />+ }+ content={+ <XDSLayoutContent>+ <XDSText type="body">+ You are about to transfer "Marketing Dashboard" to Sarah+ Chen. Once accepted, you will lose admin access.+ </XDSText>+ </XDSLayoutContent>+ }+ footer={+ <XDSLayoutFooter>+ <XDSHStack gap={2} hAlign="end">+ <XDSButton label="Cancel" variant="secondary" onClick={onClose} />+ <XDSButton label="Transfer" variant="primary" onClick={onClose} />+ </XDSHStack>+ </XDSLayoutFooter>+ }+ />+ );+}++// Remove isInline for production — dialogs should be modal.export default function DialogWithSubtitle() {- const [isOpen, setIsOpen] = useState(false);+ const dialog = useXDSImperativeDialog({purpose: 'required'});return (- <XDSCard>- <XDSVStack gap={3}>- <XDSVStack gap={1}>- <XDSText type="body" weight="bold">- Project Ownership- </XDSText>- <XDSText type="supporting" color="secondary">- Marketing Dashboard · Owner: You- </XDSText>- </XDSVStack>- <XDSButton- label="Transfer ownership"- variant="secondary"- onClick={() => setIsOpen(true)}- />- </XDSVStack>- <XDSDialog isOpen={isOpen} onOpenChange={setIsOpen} purpose="required">- <XDSLayout- header={- <XDSDialogHeader- title="Transfer project ownership"- subtitle="This action requires confirmation from the new owner"- />- }- content={- <XDSLayoutContent>- <XDSText type="body">- You are about to transfer "Marketing Dashboard" to- Sarah Chen. Once accepted, you will lose admin access.- </XDSText>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSHStack gap={2} hAlign="end">- <XDSButton- label="Cancel"- variant="secondary"- onClick={() => setIsOpen(false)}- />- <XDSButton- label="Transfer"- variant="primary"- onClick={() => setIsOpen(false)}- />- </XDSHStack>- </XDSLayoutFooter>- }+ <>+ <XDSDialog isOpen isInline onOpenChange={() => {}} purpose="required">+ <Content+ onClose={() => dialog.show(<Content onClose={() => dialog.hide()} />)}/></XDSDialog>- </XDSCard>+ {dialog.element}+ </>);}diff --git a/packages/core/src/AlertDialog/AlertDialog.doc.mjs b/packages/core/src/AlertDialog/AlertDialog.doc.mjsindex 3906c161a8..7a23a60568 100644--- a/packages/core/src/AlertDialog/AlertDialog.doc.mjs+++ b/packages/core/src/AlertDialog/AlertDialog.doc.mjs@@ -12,26 +12,44 @@ export const docs = {'delete','modal','dialog',+ 'imperative',],usage: {description:- 'AlertDialog asks the user to confirm a destructive or irreversible action before it happens. Use it for things like deleting content, revoking access, or discarding unsaved changes.',+ 'AlertDialog asks the user to confirm a destructive or irreversible action before it happens. Use it for things like deleting content, revoking access, or discarding unsaved changes.\n\nFor cases where you want to show an alert without managing open state, use the `useXDSImperativeAlertDialog` hook — call `alert.show(options)` and render `alert.element` in your tree.',bestPractices: [{guidance: true, description: 'Make the action button label specific — "Delete project" is better than "OK" or "Confirm".'},{guidance: true, description: 'Describe what will happen in the description so the user knows the consequences before confirming.'},{guidance: false, description: 'Use AlertDialog for non-destructive actions — use a standard Dialog instead.'},],},- props: [- {name: 'isOpen', type: 'boolean', required: true, description: 'Whether the dialog is open.'},- {name: 'onOpenChange', type: '(isOpen: boolean) => unknown', required: true, description: 'Visibility change callback.'},- {name: 'title', type: 'string', required: true, description: 'Dialog title. Linked via aria-labelledby.'},- {name: 'description', type: 'string', required: true, description: 'Consequence description. Linked via aria-describedby.'},- {name: 'actionLabel', type: 'string', required: true, description: 'Action button label.'},- {name: 'onAction', type: '() => unknown', required: true, description: 'Called when action button is clicked. Does NOT auto-close.'},- {name: 'cancelLabel', type: 'string', default: "'Cancel'", description: 'Cancel button label.'},- {name: 'actionVariant', type: 'XDSButtonVariant', default: "'destructive'", description: 'Action button variant.'},- {name: 'isActionLoading', type: 'boolean', description: 'Shows loading spinner on the action button.'},- {name: 'width', type: 'number | string', default: '400', description: 'Dialog width.'},+ components: [+ {+ name: 'XDSAlertDialog',+ description: 'A modal dialog that asks the user to confirm a destructive action.',+ props: [+ {name: 'isOpen', type: 'boolean', required: true, description: 'Whether the dialog is open.'},+ {name: 'onOpenChange', type: '(isOpen: boolean) => unknown', required: true, description: 'Visibility change callback.'},+ {name: 'title', type: 'string', required: true, description: 'Dialog title. Linked via aria-labelledby.'},+ {name: 'description', type: 'string', required: true, description: 'Consequence description. Linked via aria-describedby.'},+ {name: 'actionLabel', type: 'string', required: true, description: 'Action button label.'},+ {name: 'onAction', type: '() => unknown', required: true, description: 'Called when action button is clicked. Does NOT auto-close.'},+ {name: 'cancelLabel', type: 'string', default: "'Cancel'", description: 'Cancel button label.'},+ {name: 'actionVariant', type: 'XDSButtonVariant', default: "'destructive'", description: 'Action button variant.'},+ {name: 'isActionLoading', type: 'boolean', description: 'Shows loading spinner on the action button.'},+ {name: 'width', type: 'number | string', default: '400', description: 'Dialog width.'},+ {name: 'isInline', type: 'boolean', default: 'false', description: 'Renders alert dialog content inline without modal behavior. For documentation previews and showcases only.'},+ ],+ },+ {+ name: 'useXDSImperativeAlertDialog',+ description: 'Hook for showing an alert dialog without managing open state. Call alert.show(options) to open and alert.hide() to close. Render alert.element in your JSX tree.',+ props: [+ {name: 'show', type: '(options: AlertDialogOptions) => void', description: 'Show the alert dialog with the given options. Options are the same as XDSAlertDialog props minus isOpen/onOpenChange.'},+ {name: 'hide', type: '() => void', description: 'Hide the alert dialog.'},+ {name: 'isOpen', type: 'boolean', description: 'Whether the dialog is currently open.'},+ {name: 'element', type: 'ReactNode', description: 'The dialog element — render this in your JSX tree.'},+ ],+ },],};diff --git a/packages/core/src/AlertDialog/XDSAlertDialog.tsx b/packages/core/src/AlertDialog/XDSAlertDialog.tsxindex 011b21df2a..8dd36ca1d3 100644--- a/packages/core/src/AlertDialog/XDSAlertDialog.tsx+++ b/packages/core/src/AlertDialog/XDSAlertDialog.tsx@@ -31,6 +31,13 @@ export interface XDSAlertDialogProps extends XDSBaseProps<HTMLDivElement> {*/isOpen: boolean;+ /**+ * Renders alert dialog content inline without modal behavior.+ * For documentation previews and showcases only.+ * @default false+ */+ isInline?: boolean;+/*** Callback fired when the dialog visibility changes.* Called with `false` when cancel is clicked or Escape is pressed.@@ -105,6 +112,7 @@ export interface XDSAlertDialogProps extends XDSBaseProps<HTMLDivElement> {*/export function XDSAlertDialog({isOpen,+ isInline,onOpenChange,title,description,@@ -129,6 +137,7 @@ export function XDSAlertDialog({return (<XDSDialogisOpen={isOpen}+ isInline={isInline}onOpenChange={onOpenChange}width={width}purpose="form"diff --git a/packages/core/src/CommandPalette/XDSCommandPalette.doc.mjs b/packages/core/src/CommandPalette/XDSCommandPalette.doc.mjsindex 9c79978d43..692688837d 100644--- a/packages/core/src/CommandPalette/XDSCommandPalette.doc.mjs+++ b/packages/core/src/CommandPalette/XDSCommandPalette.doc.mjs@@ -101,6 +101,12 @@ export const docs = {description: 'Maximum height of the dialog.',default: '480',},+ {+ name: 'isInline',+ type: 'boolean',+ description: 'Renders command palette content inline without modal behavior. For documentation previews and showcases only.',+ default: 'false',+ },],},{@@ -327,6 +333,7 @@ export const docsZh = {label: '命令面板对话框的无障碍标签。',width: '对话框宽度。',maxHeight: '对话框最大高度。',+ isInline: '以内联方式渲染命令面板内容,不带模态行为。仅用于文档预览和展示。',},},{@@ -408,6 +415,7 @@ export const docsDense = {label: 'a11y label for dialog',width: 'dialog width',maxHeight: 'dialog max height',+ isInline: 'inline rendering for docs previews, no modal behavior',},},{diff --git a/packages/core/src/CommandPalette/XDSCommandPalette.tsx b/packages/core/src/CommandPalette/XDSCommandPalette.tsxindex bab73dd14d..7088504283 100644--- a/packages/core/src/CommandPalette/XDSCommandPalette.tsx+++ b/packages/core/src/CommandPalette/XDSCommandPalette.tsx@@ -45,6 +45,13 @@ export interface XDSCommandPaletteProps</** Whether the command palette is open. */isOpen: boolean;+ /**+ * Renders command palette content inline without modal behavior.+ * For documentation previews and showcases only.+ * @default false+ */+ isInline?: boolean;+/** Called when the command palette visibility changes. */onOpenChange: (isOpen: boolean) => void;@@ -250,6 +257,7 @@ export function XDSCommandPalette<T extends XDSSearchableItem = XDSSearchableItem,>({isOpen,+ isInline,onOpenChange,searchSource,input,@@ -491,6 +499,7 @@ export function XDSCommandPalette<return (<XDSDialogisOpen={isOpen}+ isInline={isInline}onOpenChange={open => {if (!open) handleClose();else onOpenChange(true);diff --git a/packages/core/src/Dialog/Dialog.doc.mjs b/packages/core/src/Dialog/Dialog.doc.mjsindex b442237549..efd967e481 100644--- a/packages/core/src/Dialog/Dialog.doc.mjs+++ b/packages/core/src/Dialog/Dialog.doc.mjs@@ -3,7 +3,7 @@export const docs = {name: 'Dialog',group: 'Dialog',- keywords: ["dialog","modal","popup","overlay","lightbox","alert","confirm","prompt","backdrop","focus trap"],+ keywords: ["dialog","modal","popup","overlay","lightbox","alert","confirm","prompt","backdrop","focus trap","imperative"],theming: {container: true,targets: [@@ -72,6 +72,13 @@ export const docs = {'Controls dismissal behavior: required disables Escape and backdrop click; form disables backdrop click after interaction; info allows both.',default: "'info'",},+ {+ name: 'isInline',+ type: 'boolean',+ description:+ 'Renders dialog content inline without the <dialog> element, backdrop, or modal behavior. For documentation previews and showcases only.',+ default: 'false',+ },], },{name: 'XDSDialogHeader',@@ -114,9 +121,19 @@ export const docs = {},],},+ {+ name: 'useXDSImperativeDialog',+ description: 'Hook for showing a dialog without managing open state. Call dialog.show(content, options) to open and dialog.hide() to close. Render dialog.element in your JSX tree.',+ props: [+ {name: 'show', type: '(content: ReactNode, options?: DialogOptions) => void', description: 'Show the dialog with the given content. Options are the same as XDSDialog props minus isOpen/onOpenChange/children.'},+ {name: 'hide', type: '() => void', description: 'Hide the dialog.'},+ {name: 'isOpen', type: 'boolean', description: 'Whether the dialog is currently open.'},+ {name: 'element', type: 'ReactNode', description: 'The dialog element — render this in your JSX tree.'},+ ],+ },],usage: {- description: 'Dialog displays a modal overlay that blocks interaction with the page until the user responds. Use it for delete confirmations, edit forms, terms acceptance, or any decision that should not be skipped.',+ description: 'Dialog displays a modal overlay that blocks interaction with the page until the user responds. Use it for delete confirmations, edit forms, terms acceptance, or any decision that should not be skipped.\n\nFor cases where you want to show a dialog without managing open state, use the `useXDSImperativeDialog` hook — call `dialog.show(content)` and render `dialog.element` in your tree.',bestPractices: [{ guidance: true, description: 'Choose the right purpose: info for dismissable content, form to prevent accidental backdrop dismissal, required when the user must respond.' },{ guidance: true, description: 'Include a clear title in the header so users immediately understand what the dialog is asking.' },diff --git a/packages/core/src/Dialog/XDSDialog.test.tsx b/packages/core/src/Dialog/XDSDialog.test.tsxindex 3a4f9b406a..2b7758cafa 100644--- a/packages/core/src/Dialog/XDSDialog.test.tsx+++ b/packages/core/src/Dialog/XDSDialog.test.tsx@@ -312,4 +312,35 @@ describe('XDSDialog', () => {expect(dialog.getAttribute('class')).toBeTruthy();});});++ describe('isInline', () => {+ it('renders children in a div without a <dialog> element', () => {+ const {container} = render(+ <XDSDialog isOpen={true} isInline onOpenChange={() => {}}>+ <div data-testid="child">Inline content</div>+ </XDSDialog>,+ );+ expect(screen.getByText('Inline content')).toBeInTheDocument();+ expect(container.querySelector('dialog')).toBeNull();+ });++ it('renders nothing when isOpen is false', () => {+ const {container} = render(+ <XDSDialog isOpen={false} isInline onOpenChange={() => {}}>+ <div data-testid="child">Hidden content</div>+ </XDSDialog>,+ );+ expect(screen.queryByText('Hidden content')).not.toBeInTheDocument();+ expect(container.querySelector('dialog')).toBeNull();+ });++ it('does not call showModal', () => {+ render(+ <XDSDialog isOpen={true} isInline onOpenChange={() => {}}>+ Content+ </XDSDialog>,+ );+ expect(HTMLDialogElement.prototype.showModal).not.toHaveBeenCalled();+ });+ });});diff --git a/packages/core/src/Dialog/XDSDialog.tsx b/packages/core/src/Dialog/XDSDialog.tsxindex aadb39fe06..cab4e0c0fe 100644--- a/packages/core/src/Dialog/XDSDialog.tsx+++ b/packages/core/src/Dialog/XDSDialog.tsx@@ -180,6 +180,19 @@ const styles = stylex.create({overflow: 'hidden',borderRadius: 'inherit',},+ // Inline wrapper mirrors the dialog's visual styles without <dialog> behavior+ inlineWrapper: {+ padding: 0,+ border: 'none',+ backgroundColor: colorVars['--color-background-surface'],+ '--_dialog-radius': radiusVars['--radius-container'],+ borderRadius: 'var(--_dialog-radius)',+ boxShadow: shadowVars['--shadow-high'],+ display: 'flex',+ flexDirection: 'column',+ height: 'fit-content',+ overscrollBehavior: 'contain',+ },});// Dynamic styles for width, maxHeight, and position@@ -220,6 +233,14 @@ export interface XDSDialogProps extends XDSBaseProps<HTMLDialogElement> {*/isOpen: boolean;+ /**+ * Renders dialog content inline without the <dialog> element, backdrop, or+ * modal behavior. Intended for documentation previews and showcases only —+ * not for production UIs. The dialog will not trap focus or respond to Escape.+ * @default false+ */+ isInline?: boolean;+/*** Callback fired when the dialog visibility changes.* Called with `false` when the dialog requests to be hidden.@@ -305,6 +326,7 @@ export interface XDSDialogProps extends XDSBaseProps<HTMLDialogElement> {*/export function XDSDialog({isOpen,+ isInline = false,onOpenChange,width = 400,maxHeight = '75vh',@@ -319,6 +341,13 @@ export function XDSDialog({ref,...props}: XDSDialogProps) {+ // When no explicit padding prop, use theme default (--xds-dialog-padding)+ const useThemeDefault = padding == null;+ const effectivePadding = padding ?? 4;+ const paddingToken = spacingStepToToken[effectivePadding] as SpacingToken;++ const isFullscreen = variant === 'fullscreen';+const dialogRef = useRef<HTMLDialogElement>(null);// Capture the element that was focused when the dialog opened,@@ -340,8 +369,9 @@ export function XDSDialog({}};- // Handle open/close state+ // Handle open/close state — skip for inline renderinguseEffect(() => {+ if (isInline) return;const dialog = dialogRef.current;if (!dialog) return;@@ -380,13 +410,15 @@ export function XDSDialog({triggerElementRef.current?.focus();triggerElementRef.current = null;}- }, [isOpen]);+ }, [isOpen, isInline]);// Lock body scroll when dialog is open (iOS Safari workaround)- useScrollLock(isOpen);+ // Skip for inline rendering — no modal overlay to compensate for.+ useScrollLock(isOpen && !isInline);- // Handle Escape key+ // Handle Escape key — skip for inline renderinguseEffect(() => {+ if (isInline) return;const dialog = dialogRef.current;if (!dialog || !isOpen) return;@@ -401,7 +433,7 @@ export function XDSDialog({dialog.addEventListener('keydown', handleKeyDown);return () => dialog.removeEventListener('keydown', handleKeyDown);- }, [isOpen, allowEscape, onOpenChange]);+ }, [isOpen, isInline, allowEscape, onOpenChange]);// Handle backdrop clickconst handleClick = (event: React.MouseEvent<HTMLDialogElement>) => {@@ -429,12 +461,78 @@ export function XDSDialog({}};- // When no explicit padding prop, use theme default (--xds-dialog-padding)- const useThemeDefault = padding == null;- const effectivePadding = padding ?? 4;- const paddingToken = spacingStepToToken[effectivePadding] as SpacingToken;+ // Shared inner content wrapper+ const innerContent = (+ <div+ {...stylex.props(+ styles.inner,+ ...container(+ useThemeDefault+ ? {+ useThemeDefault: 'dialog',+ maxHeight: isFullscreen+ ? undefined+ : typeof maxHeight === 'number'+ ? `${maxHeight}px`+ : maxHeight,+ }+ : {+ paddingInnerX: paddingToken,+ paddingInnerY: paddingToken,+ paddingOuterX: paddingToken,+ paddingOuterY: paddingToken,+ maxHeight: isFullscreen+ ? undefined+ : typeof maxHeight === 'number'+ ? `${maxHeight}px`+ : maxHeight,+ },+ ),+ !useThemeDefault &&+ effectivePadding !== 4 &&+ paddingStyles[effectivePadding],+ !useThemeDefault &&+ effectivePadding !== 4 &&+ containerPaddingInlineVarStyles[effectivePadding],+ !useThemeDefault &&+ effectivePadding !== 4 &&+ containerPaddingBlockStartVarStyles[effectivePadding],+ !useThemeDefault &&+ effectivePadding !== 4 &&+ containerPaddingBlockEndVarStyles[effectivePadding],+ )}>+ {children}+ </div>+ );- const isFullscreen = variant === 'fullscreen';+ // --- Inline rendering path (for documentation previews) ---+ if (isInline) {+ if (!isOpen) return null;++ return (+ <div+ {...mergeProps(+ xdsClassName('dialog', {variant}),+ stylex.props(+ styles.inlineWrapper,+ !isFullscreen && dynamicStyles.sizing(width, maxHeight),+ isFullscreen && styles.fullscreen,+ xstyle,+ ),+ className,+ style,+ )}+ data-testid={+ (props as Record<string, unknown>)['data-testid'] as+ | string+ | undefined+ }>+ {innerContent}+ </div>+ );+ }++ // --- Standard modal rendering path ---const hasPosition = position != null && !isFullscreen;// Filter out native open to prevent InvalidStateError when accidentally passed@@ -469,46 +567,7 @@ export function XDSDialog({style,)}{...safeProps}>- <div- {...stylex.props(- styles.inner,- ...container(- useThemeDefault- ? {- useThemeDefault: 'dialog',- maxHeight: isFullscreen- ? undefined- : typeof maxHeight === 'number'- ? `${maxHeight}px`- : maxHeight,- }- : {- paddingInnerX: paddingToken,- paddingInnerY: paddingToken,- paddingOuterX: paddingToken,- paddingOuterY: paddingToken,- maxHeight: isFullscreen- ? undefined- : typeof maxHeight === 'number'- ? `${maxHeight}px`- : maxHeight,- },- ),- !useThemeDefault &&- effectivePadding !== 4 &&- paddingStyles[effectivePadding],- !useThemeDefault &&- effectivePadding !== 4 &&- containerPaddingInlineVarStyles[effectivePadding],- !useThemeDefault &&- effectivePadding !== 4 &&- containerPaddingBlockStartVarStyles[effectivePadding],- !useThemeDefault &&- effectivePadding !== 4 &&- containerPaddingBlockEndVarStyles[effectivePadding],- )}>- {children}- </div>+ {innerContent}</dialog>);}