Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
Theme Table of Contents We provide a custom theme for the AG Grid library for cases where a more sophisticated table is required beyond the capabilities of our p-table component. This theme is aligned with the Porsche Design System's visual language and ensures consistency across your application. The Porsche Design System AG Grid theme is based on the default AG Grid theme, ag-theme-quartz, and is available in both light (default) and dark (data-ag-theme-mode="dark") modes. For more information on AG Grid's base themes, you can refer to the official AG Grid Themes documentation. Usage 1. Import the Theme First, import the Porsche Design System AG Grid theme into your application:
import { pdsTheme } from '@porsche-design-system/components-{js|angular|react|vue}/ag-grid';
2. Apply the Theme You can apply the theme using one of the following methods: Global Grid Options (Applies to all grid instances) Use global grid options to set the theme globally:
import { provideGlobalGridOptions } from 'ag-grid-community'; provideGlobalGridOptions({ theme: pdsTheme });
Individual Grid Options (Overrides global options): Set the theme for a specific grid instance:
const gridOptions = { theme: pdsTheme };
Component Prop Assignment Pass the theme directly as a prop:
<AgGridReact theme={pdsTheme} />
3. Change the Theme Mode By default, the Porsche Design System AG Grid theme uses a light color scheme. You can control the color scheme by setting the data-ag-theme-mode attribute on any parent element of the grid, such as the <html> or <body> tag. Available Modes: Light Mode (default) → data-ag-theme-mode is not set. Dark Mode → Set data-ag-theme-mode="dark".
<body data-ag-theme-mode="dark"></body>
Example This example is currently in development and will be added soon.
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%