Porsche Design System
You are currently viewing an earlier release of the Porsche Design System.Switch to the latest Porsche Design System documentation.
SearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
Porsche Design SystemTailwind CSSSCSSEmotionVanilla Extract
Migration Guide Table of Contents The library previously known as JS styles (/styles) has been officially rebranded as Emotion styles. While these styles may still function with Styled Components or other CSS-in-JS solutions, Emotion is the only officially supported framework moving forward. These styles are built directly upon the Tokens package; however, if you are utilizing a different styling solution, you can still consume the design tokens independently. ⭐ Introducing Color Scheme The new color system leverages the CSS light-dark() function to deliver native, preference-based theming. By adopting this browser-native engine, we have eliminated the need for proprietary switching logic, resulting in a more performant and standardized architecture.
⚠️ Deprecation Notice: Legacy Emotion color variables are officially deprecated and scheduled for removal in the next major release. We recommend migrating to the new functional tokens immediately to ensure your components remain future-proof.
Core Implementation All colors and styles are now driven by the CSS color-scheme property. To ensure broad compatibility, we provide the global colorSchemeStyles, which generates utility classes and includes a polyfill for browsers that do not yet support light-dark() (see browser support). Utility Classes Apply these classes to the document or any container to control the color-scheme context: .scheme-light — Forces light mode. .scheme-dark — Forces dark mode. .scheme-light-dark — Dynamically follows system/OS settings. Usage 1. Global Setup Include the global styles once in your main.tsx to initialize the color-scheme utilities.
import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import './index.css'; import { PorscheDesignSystemProvider } from '@porsche-design-system/components-react'; import { App } from './App.tsx'; + import { colorSchemeStyles } from '@porsche-design-system/components-react/emotion'; + import { Global } from '@emotion/react'; createRoot(document.getElementById('root')!).render( <StrictMode> + <Global styles={colorSchemeStyles} /> <PorscheDesignSystemProvider> <App /> </PorscheDesignSystemProvider> </StrictMode> );
2. Component Implementation Utilize the new tokens within your styles. These variables automatically resolve to the correct value based on the active color-scheme.
import styled from '@emotion/styled'; import { colorFrosted, colorPrimary } from '@porsche-design-system/components-react/emotion'; const MyComponent = styled.div({ backgroundColor: colorFrosted, color: colorPrimary, });
3. Application The defined color-scheme context will cascade to all child elements.
import { MyComponent } from './MyComponent'; <!-- Defined color-scheme will be applied to all child elements --> export const App = () => { return ( <div className="scheme-dark"> <MyComponent></MyComponent> </div> ); };
👹 Breaking Changes Removed getHoverStyle since it did not work reliable. Removed opts parameter in getSkeletonStyle() including theme (New skeleton style works with light-dark() CSS color function).
- getSkeletonStyle({ theme: 'light|dark' }) + getSkeletonStyle()
🤡 Deprecations (will be removed in v5) Please transition to the new styles as soon as possible. All legacy styles are currently deprecated and are scheduled for removal in the next major release. Import path Changed import path for Emotion styles.
- import { … } from '@porsche-design-system/components-{js|angular|react|vue}/styles'; + import { … } from '@porsche-design-system/components-{js|angular|react|vue}/emotion';
Blur See Emotion Blur Examples for more details.
- ...frostedGlassStyle, + backdropFilter: blurFrosted,
Border See Emotion Border Examples for more details.
- borderRadius: borderRadiusMedium, + borderRadius: radiusMd, - borderRadius: borderRadiusSmall, + borderRadius: radiusSm, - borderRadius: borderRadiusLarge, + borderRadius: radiusLg, - borderWidth: borderWidthBase, + borderWidth: 2px, - borderWidth: borderWidthThin, + borderWidth: 1px;
Color New color definitions now leverage the native CSS light-dark() function. You can explore implementation samples in the Emotion Color Examples or dive deeper into our system architecture in the Theme Guide.
- themeLightPrimary - themeDarkPrimary + colorPrimary - themeLightBackgroundBase - themeDarkBackgroundBase + colorCanvas - themeLightBackgroundSurface - themeDarkBackgroundSurface + colorSurface - themeLightBackgroundShading - themeDarkBackgroundShading + colorBackdrop - themeLightBackgroundFrosted - themeDarkBackgroundFrosted + colorFrosted - themeLightContrastLow - themeDarkContrastLow + colorContrastLow - themeLightContrastMedium - themeDarkContrastMedium + colorContrastMedium - themeLightContrastHigh - themeDarkContrastHigh + colorContrastHigh - themeLightNotificationSuccess - themeDarkNotificationSuccess + colorSuccess - themeLightNotificationSuccessSoft - themeDarkNotificationSuccessSoft + colorSuccessFrosted - themeLightNotificationWarning - themeDarkNotificationWarning + colorWarning - themeLightNotificationWarningSoft - themeDarkNotificationWarningSoft + colorWarningFrosted - themeLightNotificationError - themeDarkNotificationError + colorError - themeLightNotificationErrorSoft - themeDarkNotificationErrorSoft + colorErrorFrosted - themeLightNotificationInfo - themeDarkNotificationInfo + colorInfo - themeLightNotificationInfoSoft - themeDarkNotificationInfoSoft + colorInfoFrosted - themeLightStateHover - themeDarkStateHover // Not renamed yet, will be removed in next major release - themeLightStateActive - themeDarkStateActive // Not renamed yet, will be removed in next major release - themeLightStateFocus - themeDarkStateFocus + colorFocus - themeLightStateDisabled - themeDarkStateDisabled + colorContrastLower
Focus See Emotion Focus Examples for more details.
- ...getFocusStyle(), + ...getFocusVisibleStyle(),
Gradient See Emotion Gradient Examples for more details.
- ...gradientToBottomStyle, + background: `linear-gradient(to bottom, ${gradientStopsFadeDark});` - ...gradientToLeftStyle, + background: `linear-gradient(to left, ${gradientStopsFadeDark});` - ...gradientToRightStyle, + background: `linear-gradient(to right, ${gradientStopsFadeDark});` - ...gradientToTopStyle, + background: `linear-gradient(to top, ${gradientStopsFadeDark});`
Motion See Emotion Motion Examples for more details.
- transitionDuration: motionDurationShort, + transitionDuration: durationSm, - transitionDuration: motionDurationModerate, + transitionDuration: durationMd, - transitionDuration: motionDurationLong, + transitionDuration: durationLg, - transitionDuration: motionDurationVeryLong, + transitionDuration: durationXl, - transitionTimingFunction: motionEasingBase, + transitionTimingFunction: easeInOut, - transitionTimingFunction: motionEasingIn, + transitionTimingFunction: easeIn, - transitionTimingFunction: motionEasingOut, + transitionTimingFunction: easeOut,
Shadow See Emotion Shadow Examples for more details.
- ...dropShadowHighStyle, + boxShadow: shadowLg, - ...dropShadowMediumStyle, + boxShadow: shadowMd, - ...dropShadowLowStyle, + boxShadow: shadowSm,
Spacing See Emotion Spacing Examples for more details.
- spacingFluidXSmall + spacingFluidXs - spacingFluidSmall + spacingFluidSm - spacingFluidMedium + spacingFluidMd - spacingFluidLarge + spacingFluidLg - spacingFluidXLarge + spacingFluidXl - spacingFluidXXLarge + spacingFluid2Xl - spacingStaticXSmall + spacingStaticXs - spacingStaticSmall + spacingStaticSm - spacingStaticMedium + spacingStaticMd - spacingStaticLarge + spacingStaticLg - spacingStaticXLarge + spacingStaticXl - spacingStaticXXLarge + spacingStatic2Xl
Typography See Emotion Typography Examples for more details.
- ...displayLargeStyle, + ...proseHeading5XlStyle, - ...displayMediumStyle, + ...proseHeading4XlStyle, - ...displaySmallStyle, + ...proseHeading3XlStyle, - ...headingXXLargeStyle, + ...proseHeading2XlStyle, - ...headingXLargeStyle, + ...proseHeadingXlStyle, - ...headingLargeStyle, + ...proseHeadingLgStyle, - ...headingMediumStyle, + ...proseHeadingMdStyle, - ...headingSmallStyle, + ...proseHeadingSmStyle, - ...textXLargeStyle, + ...proseTextXlStyle, - ...textLargeStyle, + ...proseTextLgStyle, - ...textMediumStyle, + ...proseTextMdStyle, - ...textSmallStyle, + ...proseTextSmStyle, - ...textXSmallStyle, + ...proseTextXsStyle, - ...textXXSmallStyle, + ...proseText2XsStyle,
Font variables:
- fontFamily + fontPorscheNext - fontLineHeight + leadingNormal - fontWeightRegular + fontWeightNormal - fontWeightSemiBold + fontWeightSemibold - fontSizeTextXXSmall + typescale2Xs - fontSizeTextXSmall + typescaleXs - fontSizeTextSmall + typescaleSm - fontSizeTextMedium + typescaleMd - fontSizeTextLarge + typescaleLg - fontSizeTextXLarge + typescaleXl - fontSizeHeadingSmall + typescaleSm - fontSizeHeadingMedium + typescaleMd - fontSizeHeadingLarge + typescaleLg - fontSizeHeadingXLarge + typescaleXl - fontSizeHeadingXXLarge + typescale2Xl - fontSizeDisplay.small + typescale3Xl - fontSizeDisplay.medium + typescale4Xl - fontSizeDisplay.large + typescale5Xl
Global settingsColor SchemeAll color tokens use the light-dark() CSS function. Set the theme via the CSS color-scheme property: light for light mode, dark for dark mode, or light dark to follow the user's system preference.LightDarkLight DarkDirectionThe 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%