Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:
This is a pre-release version and is not production ready. For new and ongoing projects, please refer to the latest Design System version.
Communicate crucial information and request user action.
For more information on the dialog element, please refer to the MDN documentation.next.design-system.post.ch/?path=/docs/562eac2b-6dc1-4007-ba8e-4e981cef0cbc--docs&story=Default#562eac2b-6dc1-4007-ba8e-4e981cef0cbc--default
/?path=/story/562eac2b-6dc1-4007-ba8e-4e981cef0cbc--default&full=true
<dialog class="palette-default"> <form method="dialog" class="dialog-grid"> <h3 class="dialog-header"><h2>Dialog</h2></h3> <div class="dialog-body">This is a dialog</div> <div class="dialog-controls"> <button class="btn btn-primary">OK</button> <button class="btn btn-secondary">Cancel</button> </div> <button class="btn btn-close"> <span class="visually-hidden">Close</span> </button> </form> </dialog>
Make sure the @swisspost/design-system-styles
package is already present in your project or follow the installation guidelines.
To import all Design System styles:
@use '@swisspost/design-system-styles/post-compact.scss';
To import only the styles required for this component:
@use '@swisspost/design-system-styles/basics.scss'; @use '@swisspost/design-system-styles/components/dialog.scss';
next.design-system.post.ch/?path=/docs/562eac2b-6dc1-4007-ba8e-4e981cef0cbc--docs&story=Form#562eac2b-6dc1-4007-ba8e-4e981cef0cbc--form
/?path=/story/562eac2b-6dc1-4007-ba8e-4e981cef0cbc--form&full=true
Register a submit
event listener on the form. In the event handler, you have access to all the form field values inside the dialog. The dialog box closes when the form gets submitted.
document.querySelector('#example-dialog-form')?.addEventListener('submit', event => { if (!event.target) return; const formData = Object.fromEntries(new FormData(event.target as HTMLFormElement)); // Object containing your form data console.log(formData); });
The dialog can also contain arbitrary content.
next.design-system.post.ch/?path=/docs/562eac2b-6dc1-4007-ba8e-4e981cef0cbc--docs&story=Custom#562eac2b-6dc1-4007-ba8e-4e981cef0cbc--custom
/?path=/story/562eac2b-6dc1-4007-ba8e-4e981cef0cbc--custom&full=true