Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
ConfiguratorExamplesUsageAccessibilityAPI
Modal Table of Contents Scrollable modal with sticky footer If the modal's content does not fit into the current boundaries the content becomes scrollable and the footer area sticky.
Open ModalSome HeadingSome Content Begin
Some Content EndProceedCancel
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-button type="button" aria="{'aria-haspopup': 'dialog'}">
  Open Modal
</p-button>

<p-modal aria="{'aria-label': 'Some Heading'}">
  <p-heading slot="header" size="large" tag="h2">
    Some Heading
  </p-heading>
  <p-text>
    Some Content Begin
  </p-text>
  <div class="w-[10px] h-[120vh] bg-[deeppink]"></div>
  <p-text>
    Some Content End
  </p-text>
  <p-button-group slot="footer">
    <p-button type="button">
      Proceed
    </p-button>
    <p-button type="button" variant="secondary">
      Cancel
    </p-button>
  </p-button-group>
</p-modal>
<script>
  const pButton = document.querySelector("p-button");
  const pModal = document.querySelector("p-modal");
  pButton.addEventListener('click', () => (pModal.open = true));
  pModal.addEventListener('dismiss', () => (pModal.open = false));
</script>
</body>
</html>
Modal as alert dialog The p-modal component can be used as an alert dialog. This is a modal dialog that interrupts the user's workflow to draw attention to an important message and requires a response.
Open ModalSome important HeadingSome important ContentAcceptDeny
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-button type="button" aria="{'aria-haspopup': 'dialog'}">
  Open Modal
</p-button>

<p-modal aria="{'role': 'alertdialog'}" disable-backdrop-click="true">
  <p-heading slot="header" size="large" tag="h2">
    Some important Heading
  </p-heading>
  <p-text>
    Some important Content
  </p-text>
  <p-button-group slot="footer">
    <p-button type="button">
      Accept
    </p-button>
    <p-button type="button" variant="secondary">
      Deny
    </p-button>
  </p-button-group>
</p-modal>
<script>
  const pButton = document.querySelector("p-button");
  const pModal = document.querySelector("p-modal");
  pButton.addEventListener('click', () => (pModal.open = true));
  pModal.addEventListener('dismiss', () => (pModal.open = false));
</script>
</body>
</html>
Custom styling The modal component has some values which can be overwritten by CSS Custom Properties (aka CSS Variables). This might be useful for e.g. a "Cookie Consent Dialog" to reserve certain space when used with backdrop: 'shading' to always have the Porsche crest or wordmark visible in the background of the page. Since the modal is centered within the viewport and shrinks to its content, the custom vertical spacing definition will act like a safe zone. In addition, it's possible to make containers or elements (e.g. div, img etc.) stretch into the padding safe-zone by adding the CSS class.
// the modal comes with predefined margin / safe-zone which needs to be considered when a custom width is defined --p-modal-width: clamp(276px, 45.25vw + 131px, 1000px); --p-modal-spacing-top: 200px; --p-modal-spacing-bottom: 50px;
Open Modal
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-button type="button" aria="{'aria-haspopup': 'dialog'}">
  Open Modal
</p-button>

<p-modal backdrop="shading" aria="{'aria-label': 'Some Label'}" class="[--p-modal-width:clamp(276px,45.25vw+131px,1000px)] [--p-modal-spacing-top:200px] [--p-modal-spacing-bottom:50px]">
  <img src="assets/porsche-992-carrera-s.jpg" class="stretch-to-full-modal-width max-w-none" />
</p-modal>
<script>
  const pButton = document.querySelector("p-button");
  const pModal = document.querySelector("p-modal");
  pButton.addEventListener('click', () => (pModal.open = true));
  pModal.addEventListener('dismiss', () => (pModal.open = false));
</script>
</body>
</html>
Global settingsThemeChanges the theme of the application and any Porsche Design System component. It's possible to choose between forced theme light and dark. It's also possible to use auto, which applies light or dark theme depending on the operating system settings automatically.LightDarkAuto (sync with operating system)DirectionThe dir global attribute in HTML changes the direction of text and other content within an element. It's most often used on the <html> tag to set the entire page's direction, which is crucial for supporting languages that are written from right to left (RTL), such as Arabic and Hebrew. For example, using <html dir="rtl"> makes the entire page display from right to left, adjusting the layout and text flow accordingly.LTR (left-to-right)RTL (right-to-left)Text ZoomTo ensure accessibility and comply with WCAG 2.2 AA standards, it is mandatory for web content to support text resizing up to at least 200% without loss of content or functionality. Using relative units like rem is a best practice for achieving this, as they allow the text to scale uniformly based on the user's browser settings.100%130%150%200%