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)DirectionChanges the direction of HTML elements, mostly used on<html> tag to support languages which are read from right to left like e.g. Arabic.LTR (left-to-right)RTL (right-to-left)AutoText ZoomChanges the text size and values with unit rem or em relatively. This setting can be defined in browser settings for any website or by an application itself on<html> tag. To achieve WCAG 2.2 AA compliance it's obligatory to support text zoom up to at least 200%.100%130%150%200%