Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
Gradient Table of Contents Example
Gradient To Top
Gradient To Bottom
Gradient To Left
Gradient To Right
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-wrap: wrap;
        justify-content: center;
        grid-gap: $pds-grid-gap;
        padding: $pds-spacing-fluid-medium;
        background: radial-gradient(circle, rgba(238, 174, 202, 1) 0%, rgba(148, 187, 233, 1) 100%);
      }

      // Tile
      .tile {
        @include pds-text-small;
        color: $pds-theme-dark-primary;
        border-radius: $pds-border-radius-large;
        padding: $pds-spacing-fluid-medium;
      }

      // Gradient
      .gradient-to-top {
        @include pds-gradient-to-top;
      }

      .gradient-to-bottom {
        @include pds-gradient-to-bottom;
      }

      .gradient-to-left {
        @include pds-gradient-to-left;
      }

      .gradient-to-right {
        @include pds-gradient-to-right;
      }
    `,
  ],
  template: `
    <div class="wrapper">
      <div class="gradient-to-top tile">Gradient To Top</div>
      <div class="gradient-to-bottom tile">Gradient To Bottom</div>
      <div class="gradient-to-left tile">Gradient To Left</div>
      <div class="gradient-to-right tile">Gradient To Right</div>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  standalone: false,
})
export class ExampleComponent {}
Usage Do: Use only when placing text on images (e.g. a Link Tile) to provide a subtle contrast, making it easier to read. Don't: Don't build the gradient yourself. Hint The gradient consists of various points to create a smooth gradient. 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';. gradientToBottomStyle gradientToLeftStyle gradientToRightStyle gradientToTopStyle SCSS SCSS styles can be imported by @use '@porsche-design-system/components-{js|angular|react|vue}/styles' as *; @mixin pds-gradient-to-bottom() @mixin pds-gradient-to-left() @mixin pds-gradient-to-right() @mixin pds-gradient-to-top()
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%