Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
Media Query Table of Contents Example

Media Query (change viewport to see effect)

Media Query Min:

Media Query Max:

Media Query Min Max:

Breakpoint

Breakpoint Base:

Breakpoint XS:

Breakpoint S:

Breakpoint M:

Breakpoint L:

Breakpoint XL:

Breakpoint XXL:

import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
  selector: 'porsche-design-system-app',
  styles: [
    `
      @use '@porsche-design-system/components-angular/styles' as *;

      // Wrapper
      .wrapper {
        display: flex;
        flex-direction: column;
        gap: $pds-grid-gap;
        padding: $pds-spacing-fluid-medium;
      }

      // Typography
      .heading {
        @include pds-heading-medium;
        color: $pds-theme-light-primary;
        margin: 0;
      }

      .text {
        @include pds-text-small;
        color: $pds-theme-light-primary;
        margin: 0;
      }

      // MediaQueryMin
      .media-query-min {
        @include pds-media-query-min('base') {
          &::after {
            content: ' Base';
          }
        }
        @include pds-media-query-min('xs') {
          &::after {
            content: ' XS';
          }
        }
        @include pds-media-query-min('s') {
          &::after {
            content: ' S';
          }
        }
        @include pds-media-query-min('m') {
          &::after {
            content: ' M';
          }
        }
        @include pds-media-query-min('l') {
          &::after {
            content: ' L';
          }
        }
        @include pds-media-query-min('xl') {
          &::after {
            content: ' XL';
          }
        }
        @include pds-media-query-min('xxl') {
          &::after {
            content: ' XXL';
          }
        }
      }

      .media-query-max {
        @include pds-media-query-max('xxl') {
          &::after {
            content: ' XXL';
          }
        }
        @include pds-media-query-max('xl') {
          &::after {
            content: ' XL';
          }
        }
        @include pds-media-query-max('l') {
          &::after {
            content: ' L';
          }
        }
        @include pds-media-query-max('m') {
          &::after {
            content: ' M';
          }
        }
        @include pds-media-query-max('s') {
          &::after {
            content: ' S';
          }
        }
        @include pds-media-query-max('xs') {
          &::after {
            content: ' XS';
          }
        }
      }

      .media-query-min-max {
        @include pds-media-query-min-max('base', 'xs') {
          &::after {
            content: ' Base - XS';
          }
        }
        @include pds-media-query-min-max('xs', 's') {
          &::after {
            content: ' XS - S';
          }
        }
        @include pds-media-query-min-max('s', 'm') {
          &::after {
            content: ' S - M';
          }
        }
        @include pds-media-query-min-max('m', 'l') {
          &::after {
            content: ' M - L';
          }
        }
        @include pds-media-query-min-max('l', 'xl') {
          &::after {
            content: ' L - XL';
          }
        }
        @include pds-media-query-min-max('xl', 'xxl') {
          &::after {
            content: ' XL - XXL';
          }
        }
      }

      // Breakpoint
      .breakpoint-base {
        &::after {
          content: ' #{$pds-breakpoint-base}px';
        }
      }
      .breakpoint-xs {
        &::after {
          content: ' #{$pds-breakpoint-xs}px';
        }
      }
      .breakpoint-s {
        &::after {
          content: ' #{$pds-breakpoint-s}px';
        }
      }
      .breakpoint-m {
        &::after {
          content: ' #{$pds-breakpoint-m}px';
        }
      }
      .breakpoint-l {
        &::after {
          content: ' #{$pds-breakpoint-l}px';
        }
      }
      .breakpoint-xl {
        &::after {
          content: ' #{$pds-breakpoint-xl}px';
        }
      }
      .breakpoint-xxl {
        &::after {
          content: ' #{$pds-breakpoint-xxl}px';
        }
      }
    `,
  ],
  template: `
    <div class="wrapper">
      <h3 class="heading">Media Query (change viewport to see effect)</h3>
      <p class="media-query-min text">Media Query Min:</p>
      <p class="media-query-max text">Media Query Max:</p>
      <p class="media-query-min-max text">Media Query Min Max:</p>
    </div>
    <div class="wrapper">
      <h3 class="heading">Breakpoint</h3>
      <p class="breakpoint-base text">Breakpoint Base:</p>
      <p class="breakpoint-xs text">Breakpoint XS:</p>
      <p class="breakpoint-s text">Breakpoint S:</p>
      <p class="breakpoint-m text">Breakpoint M:</p>
      <p class="breakpoint-l text">Breakpoint L:</p>
      <p class="breakpoint-xl text">Breakpoint XL:</p>
      <p class="breakpoint-xxl text">Breakpoint XXL:</p>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  standalone: false,
})
export class ExampleComponent {}
Usage Do: Use breakpoints as building blocks of responsive design to control layout adaptation at specific viewport or device sizes. Follow a mobile-first approach, starting with the breakpoint base and layering on styles for larger devices. Test the application on different breakpoints to ensure that it works on all devices. Styles The styles are available as JavaScript and SCSS version. Look at the example above to see how the styles work. JS When using JSS, styled-components etc. JavaScript styles can be imported by: import { … } from '@porsche-design-system/components-{js|angular|react|vue}/styles';. When using vanilla-extract JavaScript styles can be imported by: import { … } from '@porsche-design-system/components-{js|angular|react|vue}/styles/vanilla-extract';. breakpoints breakpoint breakpointBase breakpointXS breakpointS breakpointM breakpointL breakpointXL breakpointXXL getMediaQueryMin('base'|'xs'|'s'|'m'|'l'|'xl'|'xxl') getMediaQueryMax('xs'|'s'|'m'|'l'|'xl'|'xxl') getMediaQueryMinMax('base'|'xs'|'s'|'m'|'l'|'xl', 'xs'|'s'|'m'|'l'|'xl'|'xxl') SCSS SCSS styles can be imported by @use '@porsche-design-system/components-{js|angular|react|vue}/styles' as *; $pds-breakpoint-base $pds-breakpoint-xs $pds-breakpoint-s $pds-breakpoint-m $pds-breakpoint-l $pds-breakpoint-xl $pds-breakpoint-xxl @mixin pds-media-query-min('base'|'xs'|'s'|'m'|'l'|'xl'|'xxl') @mixin pds-media-query-max('xs'|'s'|'m'|'l'|'xl'|'xxl') @mixin pds-media-query-min-max('base'|'xs'|'s'|'m'|'l'|'xl', 'xs'|'s'|'m'|'l'|'xl'|'xxl')
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%