Skip to main content

Modal

Modals present information prominently and are useful for gathering essential user input without navigating to another page.

Modal - Code

Our modals support the following sizes:

  • 360
  • 480
  • 600
  • 720
  • 840
  • full-width - Modal extends to fill entire screen width (modal will still have some horizontal margin)
  • full-screen - Modal extends to fill entire screen

The size can be configured over the configuration object of the showModal function.

Custom

How to open a modal depends on the framework in use. Note that you will not instantiate ix-modal on your own. Select the appropriate section below for the respective usage information.

Angular

By template

By instance

@siemens/ix-angular provides an injectable service that allows to open modal dialogs based on a ng-template reference or by component type. If you want to pass arbitrary data to the modal use the data-property. In order to access that data inside the modal template, use let-modal as seen in the angular example above.

ModalService

open(config: ModalConfig<TData: any, TReason: any>): Promise<ModalInstance<TData>>

React

@siemens/ix-react provides an function that allows to open modal dialogs based on a JSXElement.

Use context

It is highly recommended to provide the IxApplicationContext as part of your application.

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<IxApplicationContext>
{/*
<BrowserRouter>
<App />
</BrowserRouter>
*/}
</IxApplicationContext>
);

Vue

@siemens/ix-vue provides a function that allows to open modal dialogs based on a VNode.

JSX/TSX support

The example above is using TSX. To add JSX/TSX support in your Vue project, please refer to the Vue documentation. It is not required to use JSX and as an alternative you can use the h() function to create the modal's VNode.

Use context

It is required to provide the IxApplicationContext as part of your application in order to use the showModal function.

<script setup lang="ts">
import { IxApplicationContext } from '@siemens/ix-vue';
</script>

<template>
<IxApplicationContext>
<!-- <App /> -->
</IxApplicationContext>
</template>

Javascript

Loading

How to open a loading modal is independent of the framework in use. Note that you have to import showModalLoading from the core package @siemens/ix.

Message

How to open a message modal is independent of the framework in use. Note that you have to import showMessage from the core package @siemens/ix.

showMessage provides multiple pre-configured messages:

  • info
  • warning
  • error
  • success
  • question

The showMessage method returns a Listener with the following signature:

TypedEvent<{
actionId: string;
payload: T;
}>;

actionId represents the configured action button.

API for ix-modal-header

Properties

Events

API for ix-modal-config

Properties

API for ix-modal-instance

Properties

API for ix-modal-service (Angular)

Properties