Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
Getting StartedDemoTestingAdvancedFAQ
Angular Table of Contents Quick start To build an Angular application using the Porsche Design System, follow these steps. This guide is based on the following dependencies:
@angular/*@20tailwindcss@4@porsche-design-system/components-angular@3
# Create a new application by executing: npm install -g @angular/cli ng new my-app ✔ Do you want to create a 'zoneless' application without zone.js (Developer Preview)? "Yes" ✔ Which stylesheet format would you like to use? "CSS" ✔ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? "No"
You're all set! Start building your own application now. Integration Step 1 Install the Porsche Design System within your project directory.
npm install @porsche-design-system/components-angular
Step 2 Add the PorscheDesignSystemModule to the imports array of your @Component or @NgModule declaration.
// src/app/app.ts import { Component, signal } from '@angular/core'; import { RouterOutlet } from '@angular/router'; import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular'; @Component({ selector: 'app-root', imports: [RouterOutlet, PorscheDesignSystemModule], templateUrl: './app.html', styleUrl: './app.css', }) export class App { protected readonly title = signal('angular'); }
Step 3 (recommended) To boost your web application's performance and minimize issues like FOUC (Flash of Unstyled Content) and FOUT (Flash of Unstyled Text), you can integrate Partials from the Porsche Design System into the <head> section of your HTML. Install @angular-builders/custom-webpack within your project directory.
npm install @angular-builders/custom-webpack --save-dev
Configure the angular.json.
"architect": { "build": { - "builder": "@angular/build:application", + "builder": "@angular-builders/custom-webpack:browser", "options": { - "browser": "src/main.ts", + "indexTransform": "./index-html-transform.js", + "outputPath": "./dist", + "index": "src/index.html", + "main": "src/main.ts", } } "serve": { - "builder": "@angular/build:dev-server", + "builder": "@angular-builders/custom-webpack:dev-server",
Create a index-html-transform.js file in your project root directory.
// index-html-transform.js const partials = require('@porsche-design-system/components-angular/partials'); // https://github.com/just-jeb/angular-builders/blob/fdd7c8ed00b7eb7e1761aaa6cb5bda41693ceb5d/packages/custom-webpack/README.md#index-transform module.exports = (_, html) => { const headPartials = [ // injects stylesheet which defines visibility of pre-hydrated PDS components partials.getInitialStyles(), // injects stylesheet which defines Porsche Next CSS font-face definition (=> minimize FOUT) partials.getFontFaceStyles(), // preloads Porsche Next font (=> minimize FOUT) partials.getFontLinks(), // preloads PDS component core chunk from CDN for PDS component hydration (=> improve loading performance) partials.getComponentChunkLinks(), // preloads Porsche icons (=> minimize FOUC) partials.getIconLinks(), // injects favicon, apple touch icons, android touch icons, etc. partials.getMetaTagsAndIconLinks({ appTitle: 'Porsche' }), ].join(''); return html.replace(/<\/head>/, `${headPartials}$&`); };
Step 4 (recommended) Setting up Tailwind CSS with the Porsche Design System Tailwind CSS Theme allows you to leverage a utility-first CSS framework while maintaining seamless styling consistency with Porsche's design principles. This integration enables you to use the provided Patterns and Templates, all written in Tailwind CSS, to build your application quickly and efficiently. Install Tailwind CSS within your project directory.
npm install tailwindcss @tailwindcss/postcss postcss
Create a .postcssrc.json file in your project root directory.
// .postcssrc.json { "plugins": { "@tailwindcss/postcss": {} } }
Import Tailwind CSS and the Porsche Design System Tailwind CSS Theme.
/* src/styles.css */ @import 'tailwindcss'; @import '@porsche-design-system/components-react/tailwindcss';
Step 5 Add a Porsche Design System component (e.g., <p-wordmark></p-wordmark>) with some Tailwind CSS styles. Then, run npm run start and verify that the component and styles display correctly.
// src/app/app.html <div class="grid justify-items-center gap-fluid-md m-static-lg p-fluid-lg bg-surface rounded-lg"> <p-wordmark></p-wordmark> <h1 class="prose-display-md">Porsche Design System</h1> </div> <div class="…"></div>
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%