diff --git a/storybook/src/components/Dialog/Dialog.docs.mdx b/storybook/src/components/Dialog/Dialog.docs.mdx index 59df1161f2..a1bec5861d 100644 --- a/storybook/src/components/Dialog/Dialog.docs.mdx +++ b/storybook/src/components/Dialog/Dialog.docs.mdx @@ -22,6 +22,14 @@ Click or tap the button to open a dialog. +Some basic example code to open and close a dialog: + +```ts +const openDialog = () => (document.querySelector("#openDialog") as HTMLDialogElement)?.showModal(); + +const closeDialog = (e: MouseEvent) => e.currentTarget.closest("dialog")?.close(); +``` + ## Vertically Stacked Buttons If the buttons don’t fit next to each other, they will stack vertically and stretch to the full width.