Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
Component Chunk Links Table of Contents Function name: getComponentChunkLinks() Porsche Design System components load dynamically from a CDN as soon as they are used for the first time. This results in a waterfall like loading behaviour where your application bootstraps first, then loads the Porsche Design System Core and when any component rendered the corresponding component chunk gets loaded afterwards. This can be optimized by fetching used chunks in parallel while the application is bootstrapping. Therefore, we provide a ready to use partial in all @porsche-design-system/components-{js|angular|react|vue} packages which needs to be injected into the <head> of your index.html. An in-depth optimization guide can be found at Vanilla Js Optimization. Supported options OptionDescriptionTypeDefaultcomponentsAll components listed in the array are loaded from the CDN. By default, our core is always preloaded when using this partial.('accordion' | 'banner' | 'button-group' | 'button-pure' | 'button-tile' | 'button' | 'canvas' | 'carousel' | 'checkbox-wrapper' | 'checkbox' | 'content-wrapper' | 'crest' | 'display' | 'divider' | 'drilldown' | 'fieldset-wrapper' | 'fieldset' | 'flex' | 'flyout' | 'grid' | 'heading' | 'headline' | 'icon' | 'inline-notification' | 'input-number' | 'input-password' | 'link-pure' | 'link-social' | 'link-tile-model-signature' | 'link-tile-product' | 'link-tile' | 'link' | 'marque' | 'modal' | 'model-signature' | 'multi-select' | 'optgroup' | 'pagination' | 'pin-code' | 'popover' | 'radio-button-wrapper' | 'scroller' | 'segmented-control' | 'select-wrapper' | 'select' | 'sheet' | 'spinner' | 'stepper-horizontal' | 'switch' | 'table' | 'tabs-bar' | 'tabs' | 'tag-dismissible' | 'tag' | 'text-field-wrapper' | 'text-list' | 'text' | 'textarea-wrapper' | 'textarea' | 'toast' | 'wordmark')[][]cdnDecides from which CDN the resources are loaded.'auto' | 'cn''auto'formatDefines the output format of the partial. By default, it returns a html string, with jsx it returns valid jsx elements. When using the js option a javascript object is returned.'html' | 'jsx' | 'js''html' When using jsx in the format option, it is necessary to have react/jsx-runtime as a dependency in the project included. Examples Project integration differs based on the project setup. The following showcases the most common ways. Note: Make sure to preload only component chunks which are really needed initially!
<!-- index.html -->
<head>
  <!--PLACEHOLDER_COMPONENT_CHUNK_LINKS-->
</head>

<!-- package.json (tested on macOS, the script may need to be adjusted depending on the operating system used) -->
<!-- make sure to adjust the path to the index.html file -->
"scripts": {
  "prestart": "yarn replace",
  "replace": "placeholder='<!--PLACEHOLDER_COMPONENT_CHUNK_LINKS-->' && partial=$placeholder$(node -e 'console.log(require(\"@porsche-design-system/components-js/partials\").getComponentChunkLinks({ components: [\"button\", \"marque\"] }))') && regex=$placeholder'.*' && sed -i '' -E -e \"s^$regex^$partial^\" index.html"
  <!-- Alternative: force using China CDN -->
  "replace": "placeholder='<!--PLACEHOLDER_COMPONENT_CHUNK_LINKS-->' && partial=$placeholder$(node -e 'console.log(require(\"@porsche-design-system/components-js/partials\").getComponentChunkLinks({ cdn: \"cn\" }))') && regex=$placeholder'.*' && sed -i '' -E -e \"s^$regex^$partial^\" index.html"
}
OutputThe result of this partial looks like this:
<link rel=preload href=https://cdn.ui.porsche.com/porsche-design-system/components/porsche-design-system.v3.28.0.bb0e1f205b7459f9181a.js as=script crossorigin>
<link rel=preload href=https://cdn.ui.porsche.com/porsche-design-system/components/porsche-design-system.button.2f58cffb4015198a0cc4.js as=script>
<link rel=preload href=https://cdn.ui.porsche.com/porsche-design-system/components/porsche-design-system.marque.5c679f961f2cbd8462b2.js as=script>

// Alternative: force using China CDN
<link rel=preload href=https://cdn.ui.porsche.cn/porsche-design-system/components/porsche-design-system.v3.28.0.bb0e1f205b7459f9181a.js as=script crossorigin>
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%