@porsche-design-system/components-react 4.5.0 → 4.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/bin/pds-skill.js +259 -0
- package/esm/lib/components/button.wrapper.d.ts +2 -2
- package/esm/lib/components/link.wrapper.d.ts +2 -2
- package/package.json +4 -3
- package/skill/SKILL.md +136 -0
- package/skill/references/components/p-accordion/examples/Default.tsx +24 -0
- package/skill/references/components/p-accordion/examples/InteractiveElementsInSummary.tsx +28 -0
- package/skill/references/components/p-accordion/examples/StickySummary.tsx +24 -0
- package/skill/references/components/p-accordion/p-accordion.md +95 -0
- package/skill/references/components/p-ai-tag/examples/Default.tsx +10 -0
- package/skill/references/components/p-ai-tag/examples/WithinCheckbox.tsx +30 -0
- package/skill/references/components/p-ai-tag/examples/WithinFormLabel.tsx +37 -0
- package/skill/references/components/p-ai-tag/examples/WithinImage.tsx +13 -0
- package/skill/references/components/p-ai-tag/examples/WithinInputSearch.tsx +12 -0
- package/skill/references/components/p-ai-tag/examples/WithinRadioGroup.tsx +29 -0
- package/skill/references/components/p-ai-tag/examples/WithinTable.tsx +91 -0
- package/skill/references/components/p-ai-tag/examples/WithinText.tsx +14 -0
- package/skill/references/components/p-ai-tag/p-ai-tag.md +47 -0
- package/skill/references/components/p-banner/examples/Customization.tsx +35 -0
- package/skill/references/components/p-banner/examples/Default.tsx +24 -0
- package/skill/references/components/p-banner/p-banner.md +92 -0
- package/skill/references/components/p-button/examples/Default.tsx +12 -0
- package/skill/references/components/p-button/examples/Form.tsx +28 -0
- package/skill/references/components/p-button/examples/FormAttribute.tsx +31 -0
- package/skill/references/components/p-button/p-button.md +118 -0
- package/skill/references/components/p-button-pure/examples/CustomClickableArea.tsx +12 -0
- package/skill/references/components/p-button-pure/examples/Default.tsx +12 -0
- package/skill/references/components/p-button-pure/examples/Form.tsx +28 -0
- package/skill/references/components/p-button-pure/examples/FormAttribute.tsx +32 -0
- package/skill/references/components/p-button-pure/p-button-pure.md +118 -0
- package/skill/references/components/p-button-tile/examples/ColorScheme.tsx +15 -0
- package/skill/references/components/p-button-tile/examples/Default.tsx +18 -0
- package/skill/references/components/p-button-tile/examples/FooterSlot.tsx +29 -0
- package/skill/references/components/p-button-tile/examples/Hyphens.tsx +33 -0
- package/skill/references/components/p-button-tile/examples/UiBehaviour.tsx +41 -0
- package/skill/references/components/p-button-tile/p-button-tile.md +115 -0
- package/skill/references/components/p-canvas/examples/Default.tsx +10 -0
- package/skill/references/components/p-canvas/p-canvas.md +91 -0
- package/skill/references/components/p-carousel/examples/Default.tsx +23 -0
- package/skill/references/components/p-carousel/examples/DynamicSlides.tsx +32 -0
- package/skill/references/components/p-carousel/examples/FlexibleWidths.tsx +29 -0
- package/skill/references/components/p-carousel/examples/FocusOnCenterSlide.tsx +56 -0
- package/skill/references/components/p-carousel/examples/Intl.tsx +20 -0
- package/skill/references/components/p-carousel/examples/JumpToSlide.tsx +42 -0
- package/skill/references/components/p-carousel/p-carousel.md +142 -0
- package/skill/references/components/p-checkbox/examples/Default.tsx +10 -0
- package/skill/references/components/p-checkbox/examples/Form.tsx +45 -0
- package/skill/references/components/p-checkbox/examples/Indeterminate.tsx +13 -0
- package/skill/references/components/p-checkbox/examples/Slots.tsx +54 -0
- package/skill/references/components/p-checkbox/examples/WrappedLabel.tsx +24 -0
- package/skill/references/components/p-checkbox/p-checkbox.md +122 -0
- package/skill/references/components/p-crest/examples/CustomClickableArea.tsx +10 -0
- package/skill/references/components/p-crest/examples/Default.tsx +10 -0
- package/skill/references/components/p-crest/examples/Link.tsx +10 -0
- package/skill/references/components/p-crest/p-crest.md +65 -0
- package/skill/references/components/p-display/examples/Color.tsx +12 -0
- package/skill/references/components/p-display/examples/Default.tsx +12 -0
- package/skill/references/components/p-display/examples/Semantics.tsx +18 -0
- package/skill/references/components/p-display/examples/Size.tsx +12 -0
- package/skill/references/components/p-display/examples/SizeResponsive.tsx +12 -0
- package/skill/references/components/p-display/p-display.md +78 -0
- package/skill/references/components/p-divider/examples/Default.tsx +10 -0
- package/skill/references/components/p-divider/examples/Responsive.tsx +12 -0
- package/skill/references/components/p-divider/examples/Vertical.tsx +12 -0
- package/skill/references/components/p-divider/p-divider.md +49 -0
- package/skill/references/components/p-drilldown/examples/CustomContent.tsx +164 -0
- package/skill/references/components/p-drilldown/examples/Default.tsx +117 -0
- package/skill/references/components/p-drilldown/p-drilldown.md +168 -0
- package/skill/references/components/p-fieldset/examples/Default.tsx +12 -0
- package/skill/references/components/p-fieldset/examples/Required.tsx +13 -0
- package/skill/references/components/p-fieldset/examples/SlottedLabel.tsx +15 -0
- package/skill/references/components/p-fieldset/examples/SlottedMessage.tsx +15 -0
- package/skill/references/components/p-fieldset/p-fieldset.md +88 -0
- package/skill/references/components/p-flag/examples/Default.tsx +10 -0
- package/skill/references/components/p-flag/examples/ResponsiveSize.tsx +10 -0
- package/skill/references/components/p-flag/examples/Size.tsx +13 -0
- package/skill/references/components/p-flag/examples/SizeCssVar.tsx +10 -0
- package/skill/references/components/p-flag/p-flag.md +68 -0
- package/skill/references/components/p-flyout/examples/CustomStyling.tsx +45 -0
- package/skill/references/components/p-flyout/examples/Default.tsx +42 -0
- package/skill/references/components/p-flyout/examples/Form.tsx +54 -0
- package/skill/references/components/p-flyout/examples/StickyTop.tsx +42 -0
- package/skill/references/components/p-flyout/p-flyout.md +128 -0
- package/skill/references/components/p-heading/examples/Color.tsx +12 -0
- package/skill/references/components/p-heading/examples/Default.tsx +12 -0
- package/skill/references/components/p-heading/examples/Semantics.tsx +18 -0
- package/skill/references/components/p-heading/p-heading.md +78 -0
- package/skill/references/components/p-icon/examples/Color.tsx +13 -0
- package/skill/references/components/p-icon/examples/ColorCssVar.tsx +10 -0
- package/skill/references/components/p-icon/examples/Custom.tsx +10 -0
- package/skill/references/components/p-icon/examples/Default.tsx +10 -0
- package/skill/references/components/p-icon/examples/Overview.tsx +588 -0
- package/skill/references/components/p-icon/examples/ResponsiveSize.tsx +10 -0
- package/skill/references/components/p-icon/examples/Size.tsx +13 -0
- package/skill/references/components/p-icon/examples/SizeCssVar.tsx +10 -0
- package/skill/references/components/p-icon/p-icon.md +88 -0
- package/skill/references/components/p-inline-notification/examples/ActionButton.tsx +25 -0
- package/skill/references/components/p-inline-notification/examples/Default.tsx +10 -0
- package/skill/references/components/p-inline-notification/examples/EventHandling.tsx +25 -0
- package/skill/references/components/p-inline-notification/p-inline-notification.md +74 -0
- package/skill/references/components/p-input-date/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-date/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-date/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-date/p-input-date.md +142 -0
- package/skill/references/components/p-input-email/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-email/examples/Form.tsx +51 -0
- package/skill/references/components/p-input-email/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-email/p-input-email.md +146 -0
- package/skill/references/components/p-input-month/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-month/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-month/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-month/p-input-month.md +142 -0
- package/skill/references/components/p-input-number/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-number/examples/Form.tsx +51 -0
- package/skill/references/components/p-input-number/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-number/p-input-number.md +150 -0
- package/skill/references/components/p-input-password/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-password/examples/Form.tsx +51 -0
- package/skill/references/components/p-input-password/examples/Slots.tsx +39 -0
- package/skill/references/components/p-input-password/examples/Toggle.tsx +10 -0
- package/skill/references/components/p-input-password/p-input-password.md +145 -0
- package/skill/references/components/p-input-search/examples/AriaCombobox.tsx +35 -0
- package/skill/references/components/p-input-search/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-search/examples/Form.tsx +52 -0
- package/skill/references/components/p-input-search/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-search/p-input-search.md +182 -0
- package/skill/references/components/p-input-tel/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-tel/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-tel/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-tel/p-input-tel.md +145 -0
- package/skill/references/components/p-input-text/examples/Controlled.tsx +36 -0
- package/skill/references/components/p-input-text/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-text/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-text/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-text/p-input-text.md +150 -0
- package/skill/references/components/p-input-time/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-time/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-time/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-time/p-input-time.md +144 -0
- package/skill/references/components/p-input-url/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-url/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-url/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-url/p-input-url.md +145 -0
- package/skill/references/components/p-input-week/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-week/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-week/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-week/p-input-week.md +142 -0
- package/skill/references/components/p-link/examples/Default.tsx +12 -0
- package/skill/references/components/p-link/examples/FrameworkRouting.tsx +14 -0
- package/skill/references/components/p-link/examples/Icon.tsx +17 -0
- package/skill/references/components/p-link/p-link.md +101 -0
- package/skill/references/components/p-link-pure/examples/CustomClickableArea.tsx +12 -0
- package/skill/references/components/p-link-pure/examples/Default.tsx +12 -0
- package/skill/references/components/p-link-pure/examples/FrameworkRouting.tsx +14 -0
- package/skill/references/components/p-link-pure/examples/Icon.tsx +17 -0
- package/skill/references/components/p-link-pure/p-link-pure.md +110 -0
- package/skill/references/components/p-link-tile/examples/ColorScheme.tsx +15 -0
- package/skill/references/components/p-link-tile/examples/Default.tsx +18 -0
- package/skill/references/components/p-link-tile/examples/FooterSlot.tsx +29 -0
- package/skill/references/components/p-link-tile/examples/Hyphens.tsx +34 -0
- package/skill/references/components/p-link-tile/examples/UiBehaviour.tsx +41 -0
- package/skill/references/components/p-link-tile/examples/WithVideo.tsx +15 -0
- package/skill/references/components/p-link-tile/p-link-tile.md +105 -0
- package/skill/references/components/p-link-tile-product/examples/Default.tsx +22 -0
- package/skill/references/components/p-link-tile-product/examples/FrameworkRouting.tsx +25 -0
- package/skill/references/components/p-link-tile-product/p-link-tile-product.md +93 -0
- package/skill/references/components/p-modal/examples/AlertDialog.tsx +39 -0
- package/skill/references/components/p-modal/examples/CustomStyling.tsx +26 -0
- package/skill/references/components/p-modal/examples/Default.tsx +39 -0
- package/skill/references/components/p-modal/examples/Scrollable.tsx +43 -0
- package/skill/references/components/p-modal/p-modal.md +135 -0
- package/skill/references/components/p-model-signature/examples/CustomStyling.tsx +14 -0
- package/skill/references/components/p-model-signature/examples/Default.tsx +10 -0
- package/skill/references/components/p-model-signature/examples/MaskBlendMode.tsx +32 -0
- package/skill/references/components/p-model-signature/examples/MaskImage.tsx +12 -0
- package/skill/references/components/p-model-signature/examples/MaskVideo.tsx +12 -0
- package/skill/references/components/p-model-signature/examples/SafeZone.tsx +60 -0
- package/skill/references/components/p-model-signature/p-model-signature.md +62 -0
- package/skill/references/components/p-multi-select/examples/AsyncFilter.tsx +136 -0
- package/skill/references/components/p-multi-select/examples/Default.tsx +29 -0
- package/skill/references/components/p-multi-select/examples/Form.tsx +53 -0
- package/skill/references/components/p-multi-select/examples/Optgroups.tsx +42 -0
- package/skill/references/components/p-multi-select/examples/SelectedSlot.tsx +94 -0
- package/skill/references/components/p-multi-select/examples/SetValue.tsx +80 -0
- package/skill/references/components/p-multi-select/examples/Slots.tsx +48 -0
- package/skill/references/components/p-multi-select/p-multi-select.md +197 -0
- package/skill/references/components/p-pagination/examples/Default.tsx +10 -0
- package/skill/references/components/p-pagination/p-pagination.md +83 -0
- package/skill/references/components/p-pin-code/examples/CopyPaste.tsx +10 -0
- package/skill/references/components/p-pin-code/examples/Default.tsx +10 -0
- package/skill/references/components/p-pin-code/examples/Form.tsx +45 -0
- package/skill/references/components/p-pin-code/examples/Slots.tsx +39 -0
- package/skill/references/components/p-pin-code/p-pin-code.md +109 -0
- package/skill/references/components/p-popover/examples/Default.tsx +14 -0
- package/skill/references/components/p-popover/examples/SlottedButton.tsx +15 -0
- package/skill/references/components/p-popover/p-popover.md +116 -0
- package/skill/references/components/p-radio-group/examples/Default.tsx +17 -0
- package/skill/references/components/p-radio-group/examples/Form.tsx +53 -0
- package/skill/references/components/p-radio-group/examples/Slots.tsx +69 -0
- package/skill/references/components/p-radio-group/p-radio-group.md +157 -0
- package/skill/references/components/p-scroller/examples/Default.tsx +51 -0
- package/skill/references/components/p-scroller/examples/Height.tsx +26 -0
- package/skill/references/components/p-scroller/examples/ScrollToPosition.tsx +58 -0
- package/skill/references/components/p-scroller/p-scroller.md +93 -0
- package/skill/references/components/p-segmented-control/examples/Default.tsx +26 -0
- package/skill/references/components/p-segmented-control/examples/Form.tsx +52 -0
- package/skill/references/components/p-segmented-control/examples/Slots.tsx +54 -0
- package/skill/references/components/p-segmented-control/examples/WithLabels.tsx +26 -0
- package/skill/references/components/p-segmented-control/p-segmented-control.md +162 -0
- package/skill/references/components/p-select/examples/AsyncFilter.tsx +136 -0
- package/skill/references/components/p-select/examples/Default.tsx +29 -0
- package/skill/references/components/p-select/examples/Form.tsx +53 -0
- package/skill/references/components/p-select/examples/Optgroups.tsx +42 -0
- package/skill/references/components/p-select/examples/Required.tsx +48 -0
- package/skill/references/components/p-select/examples/SelectedSlot.tsx +124 -0
- package/skill/references/components/p-select/examples/SetValue.tsx +80 -0
- package/skill/references/components/p-select/examples/Slots.tsx +48 -0
- package/skill/references/components/p-select/examples/SlottedImages.tsx +35 -0
- package/skill/references/components/p-select/p-select.md +194 -0
- package/skill/references/components/p-sheet/examples/Default.tsx +31 -0
- package/skill/references/components/p-sheet/p-sheet.md +121 -0
- package/skill/references/components/p-spinner/examples/Color.tsx +13 -0
- package/skill/references/components/p-spinner/examples/ColorCssVar.tsx +10 -0
- package/skill/references/components/p-spinner/examples/Default.tsx +10 -0
- package/skill/references/components/p-spinner/examples/ResponsiveSize.tsx +10 -0
- package/skill/references/components/p-spinner/examples/Size.tsx +13 -0
- package/skill/references/components/p-spinner/examples/SizeCssVar.tsx +10 -0
- package/skill/references/components/p-spinner/p-spinner.md +96 -0
- package/skill/references/components/p-stepper-horizontal/examples/Default.tsx +23 -0
- package/skill/references/components/p-stepper-horizontal/examples/FrameworkImplementation.tsx +100 -0
- package/skill/references/components/p-stepper-horizontal/p-stepper-horizontal.md +109 -0
- package/skill/references/components/p-switch/examples/Default.tsx +19 -0
- package/skill/references/components/p-switch/p-switch.md +103 -0
- package/skill/references/components/p-table/examples/Advanced.tsx +186 -0
- package/skill/references/components/p-table/examples/CaptionProperty.tsx +37 -0
- package/skill/references/components/p-table/examples/CaptionSlot.tsx +40 -0
- package/skill/references/components/p-table/examples/Default.tsx +117 -0
- package/skill/references/components/p-table/examples/HideLabel.tsx +37 -0
- package/skill/references/components/p-table/examples/LayoutFixed.tsx +50 -0
- package/skill/references/components/p-table/examples/Sorting.tsx +86 -0
- package/skill/references/components/p-table/p-table.md +189 -0
- package/skill/references/components/p-tabs/examples/ActiveTab.tsx +26 -0
- package/skill/references/components/p-tabs/examples/Default.tsx +26 -0
- package/skill/references/components/p-tabs/examples/Gradient.tsx +111 -0
- package/skill/references/components/p-tabs/examples/Labelling.tsx +26 -0
- package/skill/references/components/p-tabs/p-tabs.md +136 -0
- package/skill/references/components/p-tabs-bar/examples/Default.tsx +27 -0
- package/skill/references/components/p-tabs-bar/examples/Gradient.tsx +78 -0
- package/skill/references/components/p-tabs-bar/examples/Labelling.tsx +27 -0
- package/skill/references/components/p-tabs-bar/examples/Links.tsx +20 -0
- package/skill/references/components/p-tabs-bar/p-tabs-bar.md +181 -0
- package/skill/references/components/p-tag/examples/Default.tsx +12 -0
- package/skill/references/components/p-tag/examples/Multiline.tsx +14 -0
- package/skill/references/components/p-tag/examples/SlottedButton.tsx +41 -0
- package/skill/references/components/p-tag/examples/SlottedLink.tsx +41 -0
- package/skill/references/components/p-tag/p-tag.md +66 -0
- package/skill/references/components/p-tag-dismissible/examples/Default.tsx +12 -0
- package/skill/references/components/p-tag-dismissible/p-tag-dismissible.md +75 -0
- package/skill/references/components/p-text/examples/Default.tsx +12 -0
- package/skill/references/components/p-text/examples/Semantics.tsx +18 -0
- package/skill/references/components/p-text/examples/Size.tsx +12 -0
- package/skill/references/components/p-text/examples/SizeResponsive.tsx +12 -0
- package/skill/references/components/p-text/p-text.md +68 -0
- package/skill/references/components/p-text-list/examples/Default.tsx +28 -0
- package/skill/references/components/p-text-list/p-text-list.md +68 -0
- package/skill/references/components/p-textarea/examples/Default.tsx +10 -0
- package/skill/references/components/p-textarea/examples/Form.tsx +45 -0
- package/skill/references/components/p-textarea/examples/Slots.tsx +39 -0
- package/skill/references/components/p-textarea/p-textarea.md +122 -0
- package/skill/references/components/p-toast/examples/Default.tsx +22 -0
- package/skill/references/components/p-toast/p-toast.md +61 -0
- package/skill/references/components/p-wordmark/examples/CustomClickableArea.tsx +10 -0
- package/skill/references/components/p-wordmark/examples/Default.tsx +10 -0
- package/skill/references/components/p-wordmark/examples/Size.tsx +10 -0
- package/skill/references/components/p-wordmark/p-wordmark.md +66 -0
- package/skill/references/icons.md +5 -0
- package/skill/references/styles/emotion.md +439 -0
- package/skill/references/styles/scss.md +402 -0
- package/skill/references/styles/tailwindcss.md +356 -0
- package/skill/references/styles/vanilla-extract.md +444 -0
- package/skill/references/stylesheets.md +331 -0
- package/skill/references/tokens.md +323 -0
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +1 -1
- package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +1 -1
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +1 -1
- package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +1 -1
- package/ssr/esm/lib/components/button.wrapper.d.ts +2 -2
- package/ssr/esm/lib/components/link.wrapper.d.ts +2 -2
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# p-accordion
|
|
2
|
+
|
|
3
|
+
The `p-accordion` is a component that reveals or hides associated sections of content. Accordions are flexible in the context and can include other components of the Porsche Design System.
|
|
4
|
+
|
|
5
|
+
It is a controlled component. This means it does not contain any internal state, and you got full control over its behavior.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
### Do:
|
|
10
|
+
|
|
11
|
+
- Use accordions to organize and display large amounts of content in a structured and efficient way.
|
|
12
|
+
- Group related content together within each accordion panel.
|
|
13
|
+
- Use clear and concise headings for each accordion panel to help users quickly understand what content is included.
|
|
14
|
+
- Make sure that each accordion panel is easily identifiable and distinguishable from the others.
|
|
15
|
+
|
|
16
|
+
### Don't:
|
|
17
|
+
|
|
18
|
+
- Don't use accordions for content that is essential or required for users to see. Users may not realize that they need to expand the accordion panel to see the content, resulting in a poor user experience.
|
|
19
|
+
- Don't overuse accordions on a single page, as this can make the page feel cluttered and difficult to navigate.
|
|
20
|
+
- Don't use ambiguous or confusing labels for the accordion headings, as this can make it difficult for users to understand what content is included in each panel.
|
|
21
|
+
- Don't overload the accordion panels with too much content, as this can make the component feel overwhelming and difficult to use.
|
|
22
|
+
- Don't add a divider on top of the first item.
|
|
23
|
+
|
|
24
|
+
## Accessibility support
|
|
25
|
+
|
|
26
|
+
### Keyboard
|
|
27
|
+
|
|
28
|
+
| Key / state | Function |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
31
|
+
| `Enter/Space` | When focus is on the accordion trigger, the associated panel expands or collapses. |
|
|
32
|
+
|
|
33
|
+
## Development considerations
|
|
34
|
+
|
|
35
|
+
### Heading hierarchy
|
|
36
|
+
|
|
37
|
+
The accordion summary should be a heading element (e.g.,`p-heading` or `<h1>` to `<h6>`,) to ensure proper semantic structure and correct heading hierarchy.
|
|
38
|
+
|
|
39
|
+
### Common do's and don'ts
|
|
40
|
+
|
|
41
|
+
- **Do** use the `summary` slot with a heading element such as `p-heading` or native `h1`–`h6`.
|
|
42
|
+
- **Do** keep heading levels sequential across multiple accordions on a page.
|
|
43
|
+
- **Don't** use plain text in the summary without a semantic heading.
|
|
44
|
+
|
|
45
|
+
## API
|
|
46
|
+
|
|
47
|
+
### Properties
|
|
48
|
+
|
|
49
|
+
| Property | Type | Default | Description |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
| `alignMarker` | `'start'` `'end'` | `'end'` | Positions the expand/collapse marker icon at the start or end of the summary section. |
|
|
52
|
+
| `background` | `'canvas'` `'surface'` `'frosted'` `'none'` | `'none'` | Sets the background color of the accordion panel. Use `frosted` only when placed on images, videos, or gradients. |
|
|
53
|
+
| `compact` | `boolean` | `undefined` | Reduces padding and spacing for a more compact layout, useful in space-constrained interfaces. |
|
|
54
|
+
| `heading` _(deprecated)_ | `string` | `undefined` | @deprecated Will be removed in the next major release. Use the `summary` slot instead. Sets the heading text within the summary section. |
|
|
55
|
+
| `headingTag` _(deprecated)_ | `'h1'` `'h2'` `'h3'` `'h4'` `'h5'` `'h6'` | `'h2'` | @deprecated Will be removed in the next major release. Use the `summary` slot instead. Sets the heading tag for proper semantic structure within the page. |
|
|
56
|
+
| `indent` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Indents the slotted content to be vertically aligned with the text of the summary section. |
|
|
57
|
+
| `open` | `boolean` | `undefined` | Controls whether the accordion is open or closed. |
|
|
58
|
+
| `size` _(deprecated)_ | `'small'` `'medium'`<br>`BreakpointCustomizable<AccordionSize>` | `'small'` | @deprecated Will be removed in the next major release. Use the `summary` slot instead. Controls the heading size in the summary section (only applies when using the `heading` prop or `heading` slot). |
|
|
59
|
+
| `sticky` _(experimental)_ | `boolean` | `undefined` | @experimental Makes the summary section sticky at the top while scrolling. Only works with `background="canvas"` or `background="surface"`. Not compatible with `summary-before` or `summary-after` slots. |
|
|
60
|
+
|
|
61
|
+
### Events
|
|
62
|
+
|
|
63
|
+
| Event | Type | Description |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `update` | `CustomEvent<AccordionUpdateEventDetail>`<br>`{ open: boolean }` | Emitted when the user toggles the accordion open or closed, with the new open state in the event detail. |
|
|
66
|
+
|
|
67
|
+
### Controlled properties
|
|
68
|
+
|
|
69
|
+
- `open` — a controlled prop: the component does **not** update it itself. Handle the `update` event and assign the new value to `open` yourself, or the change will not take effect.
|
|
70
|
+
|
|
71
|
+
### Slots
|
|
72
|
+
|
|
73
|
+
| Slot | Required | Allowed tag names | Description |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| `summary` | no | — | Content for the accordion's summary section. Clicking toggles the accordion open and closed. |
|
|
76
|
+
| `summary-before` | no | — | Content or interactive elements placed before the accordion's summary section. |
|
|
77
|
+
| `summary-after` | no | — | Content or interactive elements placed after the accordion's summary section. |
|
|
78
|
+
| `heading` _(deprecated)_ | no | — | Content for the accordion's heading section. Clicking toggles the accordion open and closed. |
|
|
79
|
+
| _(default)_ | no | — | Main content displayed when the accordion is expanded. |
|
|
80
|
+
|
|
81
|
+
### CSS Variables
|
|
82
|
+
|
|
83
|
+
| CSS Variable | Default | Description |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `--p-accordion-summary-top` | `0px` | Controls the sticky top position when `sticky` is enabled. |
|
|
86
|
+
| `--p-accordion-px` | `16px` | Horizontal padding of the accordion. |
|
|
87
|
+
| `--p-accordion-py` | `16px` | Vertical padding of the accordion. |
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
| Example | When to use | File |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
94
|
+
| Sticky summary | The summary can be made sticky by adding the experimental property `sticky` to the `p-accordion` tag. | [./examples/StickySummary.tsx](./examples/StickySummary.tsx) |
|
|
95
|
+
| Interactive elements in summary | The summary section supports interactive elements via the `slot="summary-before"` and `slot="summary-after"` attributes. | [./examples/InteractiveElementsInSummary.tsx](./examples/InteractiveElementsInSummary.tsx) |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PAiTag, PCheckbox, PFieldset, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PFieldset label="Pick your favorite Fruits" labelSize="small" className="flex flex-col gap-static-sm">
|
|
8
|
+
<PText className="-mt-static-md mb-static-sm">
|
|
9
|
+
Slotted description with optional link
|
|
10
|
+
</PText>
|
|
11
|
+
<div className="flex flex-col gap-static-sm">
|
|
12
|
+
<PCheckbox>
|
|
13
|
+
<span slot="label">
|
|
14
|
+
Banana
|
|
15
|
+
<PAiTag variant="generated" className="ms-static-sm"></PAiTag>
|
|
16
|
+
</span>
|
|
17
|
+
</PCheckbox>
|
|
18
|
+
<PCheckbox label="Apple"></PCheckbox>
|
|
19
|
+
<PCheckbox checked={true}>
|
|
20
|
+
<span slot="label">
|
|
21
|
+
Melon
|
|
22
|
+
<PAiTag variant="abbreviation" className="ms-static-sm"></PAiTag>
|
|
23
|
+
</span>
|
|
24
|
+
</PCheckbox>
|
|
25
|
+
<PCheckbox label="Grapefruit"></PCheckbox>
|
|
26
|
+
</div>
|
|
27
|
+
</PFieldset>
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PAiTag, POptgroup, PSelect, PSelectOption } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PSelect name="options" description="Some description">
|
|
8
|
+
<span slot="label">
|
|
9
|
+
Pick your favorite Fruits
|
|
10
|
+
<PAiTag variant="abbreviation" className="ms-static-sm"></PAiTag>
|
|
11
|
+
</span>
|
|
12
|
+
<POptgroup label="Some optgroup label 1">
|
|
13
|
+
<PSelectOption value="a">
|
|
14
|
+
Option A
|
|
15
|
+
</PSelectOption>
|
|
16
|
+
<PSelectOption value="b">
|
|
17
|
+
Option B
|
|
18
|
+
</PSelectOption>
|
|
19
|
+
<PSelectOption value="c">
|
|
20
|
+
Option C
|
|
21
|
+
</PSelectOption>
|
|
22
|
+
</POptgroup>
|
|
23
|
+
<POptgroup label="Some optgroup label 2">
|
|
24
|
+
<PSelectOption value="d">
|
|
25
|
+
Option D
|
|
26
|
+
</PSelectOption>
|
|
27
|
+
<PSelectOption value="e">
|
|
28
|
+
Option E
|
|
29
|
+
</PSelectOption>
|
|
30
|
+
<PSelectOption value="f">
|
|
31
|
+
Option F
|
|
32
|
+
</PSelectOption>
|
|
33
|
+
</POptgroup>
|
|
34
|
+
</PSelect>
|
|
35
|
+
</>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PAiTag } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<div className="relative inline-block rounded-lg overflow-hidden">
|
|
8
|
+
<img src="assets/ai-tag-image.jpg" alt="AI modified image" className="block w-[300px] h-[300px] object-cover" />
|
|
9
|
+
<PAiTag variant="modified" className="absolute bottom-static-sm end-static-sm scheme-dark"></PAiTag>
|
|
10
|
+
</div>
|
|
11
|
+
</>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PAiTag, PInputSearch } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PInputSearch label="What's your favorite Fruit" description="Search for fruits" name="search">
|
|
8
|
+
<PAiTag slot="end" variant="abbreviation"></PAiTag>
|
|
9
|
+
</PInputSearch>
|
|
10
|
+
</>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PAiTag, PHeading, PRadioGroup, PRadioGroupOption } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PHeading size="small" tag="h3">
|
|
8
|
+
Pick your favorite Fruits
|
|
9
|
+
</PHeading>
|
|
10
|
+
|
|
11
|
+
<PRadioGroup label="Some Label" name="fruit" value="banana" className="mt-static-sm">
|
|
12
|
+
<PRadioGroupOption value="banana">
|
|
13
|
+
<span slot="label">
|
|
14
|
+
Banana
|
|
15
|
+
<PAiTag variant="generated" className="ms-static-sm"></PAiTag>
|
|
16
|
+
</span>
|
|
17
|
+
</PRadioGroupOption>
|
|
18
|
+
<PRadioGroupOption value="apple" label="Apple"></PRadioGroupOption>
|
|
19
|
+
<PRadioGroupOption value="melon">
|
|
20
|
+
<span slot="label">
|
|
21
|
+
Melon
|
|
22
|
+
<PAiTag variant="abbreviation" className="ms-static-sm"></PAiTag>
|
|
23
|
+
</span>
|
|
24
|
+
</PRadioGroupOption>
|
|
25
|
+
<PRadioGroupOption value="grapefruit" label="Grapefruit"></PRadioGroupOption>
|
|
26
|
+
</PRadioGroup>
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PAiTag, PHeading, PTable, PTableBody, PTableCell, PTableHead, PTableHeadCell, PTableHeadRow, PTableRow } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<div className="w-full">
|
|
8
|
+
<PTable>
|
|
9
|
+
<PHeading slot="caption" size="large" tag="h3">
|
|
10
|
+
Some slotted caption
|
|
11
|
+
</PHeading>
|
|
12
|
+
<PTableHead>
|
|
13
|
+
<PTableHeadRow>
|
|
14
|
+
<PTableHeadCell sort={{'id': 'model', 'active': 'true', 'direction': 'desc'}}>
|
|
15
|
+
Model
|
|
16
|
+
</PTableHeadCell>
|
|
17
|
+
<PTableHeadCell>
|
|
18
|
+
Date
|
|
19
|
+
</PTableHeadCell>
|
|
20
|
+
<PTableHeadCell>
|
|
21
|
+
Purchase Intention
|
|
22
|
+
</PTableHeadCell>
|
|
23
|
+
<PTableHeadCell>
|
|
24
|
+
<span className="inline-flex items-center gap-static-sm">
|
|
25
|
+
Status
|
|
26
|
+
<PAiTag variant="abbreviation"></PAiTag>
|
|
27
|
+
</span>
|
|
28
|
+
</PTableHeadCell>
|
|
29
|
+
<PTableHeadCell>
|
|
30
|
+
Lead ID
|
|
31
|
+
</PTableHeadCell>
|
|
32
|
+
</PTableHeadRow>
|
|
33
|
+
</PTableHead>
|
|
34
|
+
<PTableBody>
|
|
35
|
+
<PTableRow>
|
|
36
|
+
<PTableCell>
|
|
37
|
+
718 Cayman
|
|
38
|
+
</PTableCell>
|
|
39
|
+
<PTableCell>
|
|
40
|
+
23.06.2021
|
|
41
|
+
</PTableCell>
|
|
42
|
+
<PTableCell>
|
|
43
|
+
New Car
|
|
44
|
+
</PTableCell>
|
|
45
|
+
<PTableCell>
|
|
46
|
+
Won
|
|
47
|
+
</PTableCell>
|
|
48
|
+
<PTableCell>
|
|
49
|
+
0000824402
|
|
50
|
+
</PTableCell>
|
|
51
|
+
</PTableRow>
|
|
52
|
+
<PTableRow>
|
|
53
|
+
<PTableCell>
|
|
54
|
+
Panamera 4S
|
|
55
|
+
</PTableCell>
|
|
56
|
+
<PTableCell>
|
|
57
|
+
15.03.2023
|
|
58
|
+
</PTableCell>
|
|
59
|
+
<PTableCell>
|
|
60
|
+
Used Car
|
|
61
|
+
</PTableCell>
|
|
62
|
+
<PTableCell>
|
|
63
|
+
Lost
|
|
64
|
+
</PTableCell>
|
|
65
|
+
<PTableCell>
|
|
66
|
+
0000824408
|
|
67
|
+
</PTableCell>
|
|
68
|
+
</PTableRow>
|
|
69
|
+
<PTableRow>
|
|
70
|
+
<PTableCell>
|
|
71
|
+
911 Carrera S
|
|
72
|
+
</PTableCell>
|
|
73
|
+
<PTableCell>
|
|
74
|
+
28.08.2025
|
|
75
|
+
</PTableCell>
|
|
76
|
+
<PTableCell>
|
|
77
|
+
New Car
|
|
78
|
+
</PTableCell>
|
|
79
|
+
<PTableCell>
|
|
80
|
+
Won
|
|
81
|
+
</PTableCell>
|
|
82
|
+
<PTableCell>
|
|
83
|
+
0000824409
|
|
84
|
+
</PTableCell>
|
|
85
|
+
</PTableRow>
|
|
86
|
+
</PTableBody>
|
|
87
|
+
</PTable>
|
|
88
|
+
</div>
|
|
89
|
+
</>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PAiTag, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PText>
|
|
8
|
+
This content was generated using artificial intelligence (AI). AI can be a powerful tool for creating content, but it's important to be transparent about its use. By including an AI tag, we can inform users that this content may have been modified or generated by AI, helping to build trust and provide context for the information presented.
|
|
9
|
+
<PAiTag variant="modified" className="align-bottom"></PAiTag>
|
|
10
|
+
This is some additional text to show how the AI tag can be used within a text component. The AI tag can be used to indicate that certain content has been modified or generated by AI, providing transparency to users.
|
|
11
|
+
</PText>
|
|
12
|
+
</>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# p-ai-tag
|
|
2
|
+
|
|
3
|
+
`p-ai-tag` is used to indicate AI-generated or AI-modified content. It displays a localized and legally compliant AI label text (abbreviated or as long-form) combined with an icon.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Use the AI tag to indicate that content has been generated or assisted by artificial intelligence.
|
|
8
|
+
|
|
9
|
+
The following segment provides instructions for designers and developers regarding the appropriate utilization of this component in various situations.
|
|
10
|
+
|
|
11
|
+
### Do:
|
|
12
|
+
|
|
13
|
+
- Use to indicate AI-generated or AI-assisted content.
|
|
14
|
+
- Use the appropriate `locale` to match the user's language.
|
|
15
|
+
- Use the `abbreviation` variant for compact contexts where space is limited.
|
|
16
|
+
- Use the `generated` or `modified` variant when a full label improves clarity.
|
|
17
|
+
|
|
18
|
+
### Don't:
|
|
19
|
+
|
|
20
|
+
- Don't use as a general-purpose tag — use `p-tag` instead.
|
|
21
|
+
- Don't use for non-AI-related labeling or categorization.
|
|
22
|
+
|
|
23
|
+
## Accessibility support
|
|
24
|
+
|
|
25
|
+
For the `abbreviation` variant, the component uses an `<abbr>` element so the full “artificial intelligence” term is available as the expansion.
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
### Properties
|
|
30
|
+
|
|
31
|
+
| Property | Type | Default | Description |
|
|
32
|
+
| --- | --- | --- | --- |
|
|
33
|
+
| `locale` | `'bg_BG'` `'bs_BA'` `'cs_CZ'` `'da_DK'` `'de_DE'` `'el_GR'` `'en_CY'` `'en_GB'` `'en_US'` `'es_ES'` `'et_EE'` `'fi_FI'` `'fr_FR'` `'he_IL'` `'hr_HR'` `'hu_HU'` `'is_IS'` `'it_IT'` `'lt_LT'` `'lv_LV'` `'me_ME'` `'mk_MK'` `'mt_MT'` `'nb_NO'` `'nl_NL'` `'pl_PL'` `'pt_PT'` `'ro_RO'` `'ru_RU'` `'sk_SK'` `'sl_SI'` `'sr_RS'` `'sv_SE'` `'tr_TR'` `'uk_UA'` | `'en_US'` | Locale for the AI text (ISO format, e.g. "de_DE"). |
|
|
34
|
+
| `variant` | `'abbreviation'` `'generated'` `'modified'` | `'generated'` | Variant to display: 'abbreviation' (e.g. "AI"), 'generated' (e.g. "AI-generated"), or 'modified' (e.g. "AI-modified"). |
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
| Example | When to use | File |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
41
|
+
| Within Checkbox | The `p-ai-tag` can be used inline with other form components. | [./examples/WithinCheckbox.tsx](./examples/WithinCheckbox.tsx) |
|
|
42
|
+
| Within Radio Group | The `p-ai-tag` can also be placed within the slotted label of a `p-radio-button-wrapper` to indicate AI-related content for individual radio options. | [./examples/WithinRadioGroup.tsx](./examples/WithinRadioGroup.tsx) |
|
|
43
|
+
| Within Form Label | The `p-ai-tag` can be placed within a `label` of a `p-select` (or any other form component) to indicate AI-related content for selected options. | [./examples/WithinFormLabel.tsx](./examples/WithinFormLabel.tsx) |
|
|
44
|
+
| Within Input Search | The `p-ai-tag` can be placed in the `end` slot of a `p-input-search` to indicate that the search results are AI-powered. | [./examples/WithinInputSearch.tsx](./examples/WithinInputSearch.tsx) |
|
|
45
|
+
| Within Text | The `p-ai-tag` can be placed inline within a `p-text` to indicate that the surrounding text content is AI-related. | [./examples/WithinText.tsx](./examples/WithinText.tsx) |
|
|
46
|
+
| Within Image | The `p-ai-tag` can be positioned as an overlay on images to indicate that the image content has been generated or modified by AI. | [./examples/WithinImage.tsx](./examples/WithinImage.tsx) |
|
|
47
|
+
| Within Table | The `p-ai-tag` can sit inline in a `p-table-head-cell` next to the column title — for example on a **Status** column when that data is AI-assisted. | [./examples/WithinTable.tsx](./examples/WithinTable.tsx) |
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PBanner, PButton, PHeading, PLinkPure, PText } from '@porsche-design-system/components-react';
|
|
4
|
+
|
|
5
|
+
export const Example = () => {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
|
|
8
|
+
const onClick = () => {
|
|
9
|
+
setOpen(true);
|
|
10
|
+
}
|
|
11
|
+
const onDismiss = () => {
|
|
12
|
+
setOpen(false);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<PButton type="button" onClick={onClick}>
|
|
18
|
+
Open Banner
|
|
19
|
+
</PButton>
|
|
20
|
+
|
|
21
|
+
<PBanner open={open} className="[--p-banner-top:8px] [--p-banner-bottom:8px] [--p-banner-inset-x:8px] [--p-banner-max-w:70ch]" onDismiss={onDismiss}>
|
|
22
|
+
<PHeading slot="heading" size="sm" weight="semibold">
|
|
23
|
+
Some heading
|
|
24
|
+
</PHeading>
|
|
25
|
+
<PText slot="description">
|
|
26
|
+
Some description. You can also add inline
|
|
27
|
+
<PLinkPure href="https://porsche.com" icon="none" underline={true}>
|
|
28
|
+
links
|
|
29
|
+
</PLinkPure>
|
|
30
|
+
to route to another page.
|
|
31
|
+
</PText>
|
|
32
|
+
</PBanner>
|
|
33
|
+
</>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PBanner, PButton } from '@porsche-design-system/components-react';
|
|
4
|
+
|
|
5
|
+
export const Example = () => {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
|
|
8
|
+
const onClick = () => {
|
|
9
|
+
setOpen(true);
|
|
10
|
+
}
|
|
11
|
+
const onDismiss = () => {
|
|
12
|
+
setOpen(false);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<PButton type="button" onClick={onClick}>
|
|
18
|
+
Open Banner
|
|
19
|
+
</PButton>
|
|
20
|
+
|
|
21
|
+
<PBanner open={open} heading="Some Heading" headingTag="h3" description="Some Description" onDismiss={onDismiss}></PBanner>
|
|
22
|
+
</>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# p-banner
|
|
2
|
+
|
|
3
|
+
The `p-banner` component provides action-based feedback messages (e.g. after performing a task) or to convey informational and/or critical notification like some site related topics.
|
|
4
|
+
|
|
5
|
+
Review the [notification decision tree](https://designsystem.porsche.com/patterns/notifications/decision-tree) to determine which notification component is best for a particular scenario.
|
|
6
|
+
|
|
7
|
+
For more information about the Usage of the `p-banner` checkout the [Notification](https://designsystem.porsche.com/patterns/notifications/introduction) page.
|
|
8
|
+
|
|
9
|
+
## Accessibility support
|
|
10
|
+
|
|
11
|
+
### Keyboard
|
|
12
|
+
|
|
13
|
+
| Key / state | Function |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `ESC` | Closes the Banner. |
|
|
16
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next focusable element. |
|
|
17
|
+
| `focus` | Moves focus automatically to the close button. |
|
|
18
|
+
|
|
19
|
+
### ARIA enhancements
|
|
20
|
+
|
|
21
|
+
#### Internal **ARIA** that is managed by the component:
|
|
22
|
+
|
|
23
|
+
| ARIA | Usage |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `role="status"` | When content is populated or changed in `state="info"`, the component announces it unobtrusively. |
|
|
26
|
+
| `role="alert"` | When content is populated or changed in `state="warning/error"`, the component announces it immediately. |
|
|
27
|
+
| `aria-label="STRING"` | References the accessible name. |
|
|
28
|
+
|
|
29
|
+
## Development considerations
|
|
30
|
+
|
|
31
|
+
### Focus handling
|
|
32
|
+
|
|
33
|
+
To support **keyboard navigation**, please take care of correct **focus handling** after closing the `Banner` with `ESC` or `Enter` key: The trigger element (e.g. a button) which has opened the `Banner` must receive focus state again after the `Banner` is closed. This is important to keep focus order consistent.
|
|
34
|
+
|
|
35
|
+
### ARIA live announcements
|
|
36
|
+
|
|
37
|
+
The `Banner` component uses `role="status"` and `role="alert"` to announce **content changes** for assistive technologies, but only if the component is **pre-rendered** and the content is added dynamically.
|
|
38
|
+
|
|
39
|
+
### Common do's and don'ts
|
|
40
|
+
|
|
41
|
+
- **Do** pre-render the banner in the DOM and update its content when showing feedback.
|
|
42
|
+
- **Do** provide meaningful `heading` and `description` text for warnings and errors.
|
|
43
|
+
- **Do** return focus to the trigger or at a logical place after the banner is dismissed.
|
|
44
|
+
- **Don't** mount the entire banner only at the moment it should be announced.
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
### Properties
|
|
49
|
+
|
|
50
|
+
| Property | Type | Default | Description |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| `description` | `string` | `''` | Sets the supporting description text shown below the heading. |
|
|
53
|
+
| `dismissButton` | `boolean` | `true` | Shows a dismiss button so the user can manually close the banner. |
|
|
54
|
+
| `heading` | `string` | `''` | Sets the heading text displayed at the top of the banner. |
|
|
55
|
+
| `headingTag` | `'h1'` `'h2'` `'h3'` `'h4'` `'h5'` `'h6'` | `'h5'` | Sets the HTML heading tag (e.g. h2, h3) to maintain correct document structure for the heading. |
|
|
56
|
+
| `open` _(required)_ | `boolean` | `false` | Controls whether the banner is visible. Set to `true` to show it and `false` to hide it. |
|
|
57
|
+
| `position` | `'top'` `'bottom'`<br>`BreakpointCustomizable<BannerPosition>` | `{"base":"bottom","s":"top"}` | Sets the position of the banner on screen — `top` or `bottom`. Supports responsive breakpoint values. |
|
|
58
|
+
| `state` | `'info'` `'success'` `'warning'` `'error'` | `'info'` | Sets the visual state of the banner — controls the icon and color scheme (`info`, `warning`, `error`, `success`). |
|
|
59
|
+
|
|
60
|
+
### Events
|
|
61
|
+
|
|
62
|
+
| Event | Type | Description |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| `dismiss` | `CustomEvent<void>` | Emitted when the user closes the banner via the dismiss button or Escape key. |
|
|
65
|
+
|
|
66
|
+
### Controlled properties
|
|
67
|
+
|
|
68
|
+
- `open` — a controlled prop: the component does **not** update it itself. Handle the `dismiss` event and assign the new value to `open` yourself, or the change will not take effect.
|
|
69
|
+
|
|
70
|
+
### Slots
|
|
71
|
+
|
|
72
|
+
| Slot | Required | Allowed tag names | Description |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| `heading` | no | — | Defines the heading of the banner. Can be used as an alternative to the `heading` prop for rich content. |
|
|
75
|
+
| _(default)_ | no | — | Default slot for the banner description content. |
|
|
76
|
+
| `description` _(deprecated)_ | no | — | Deprecated: Use the default slot instead. |
|
|
77
|
+
|
|
78
|
+
### CSS Variables
|
|
79
|
+
|
|
80
|
+
| CSS Variable | Default | Description |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| `--p-banner-max-w` | `100ch` | Defines the maximum width of the Banner. |
|
|
83
|
+
| `--p-banner-top` | `56px` | Defines the distance from the top of the viewport. Only takes effect when the `position` property is set to `top` (at the respective breakpoint). |
|
|
84
|
+
| `--p-banner-bottom` | `56px` | Defines the distance from the bottom of the viewport. Only takes effect when the `position` property is set to `bottom` (at the respective breakpoint). |
|
|
85
|
+
| `--p-banner-inset-x` | `max(22px, 10.625vw - 12px)` | Defines the horizontal offset of the Banner from the edges of the viewport. |
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
| Example | When to use | File |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
92
|
+
| Customization | Rich content for `heading` and `description` can be provided via named slots. | [./examples/Customization.tsx](./examples/Customization.tsx) |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButton, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
import { type FormEvent, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
export const Example = () => {
|
|
6
|
+
const [lastSubmittedData, setLastSubmittedData] = useState('none');
|
|
7
|
+
|
|
8
|
+
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
const formData = Array.from(new FormData(e.currentTarget, (e.nativeEvent as SubmitEvent).submitter).entries())[0];
|
|
11
|
+
setLastSubmittedData(formData.join('=') || 'none');
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<form onSubmit={handleSubmit} className="flex gap-fluid-sm">
|
|
17
|
+
<PButton name="option" value="A" type="submit">
|
|
18
|
+
Button A
|
|
19
|
+
</PButton>
|
|
20
|
+
<PButton name="option" value="B" type="submit">
|
|
21
|
+
Button B
|
|
22
|
+
</PButton>
|
|
23
|
+
</form>
|
|
24
|
+
|
|
25
|
+
<PText>Last submitted data: {lastSubmittedData}</PText>
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButton, PText, PTextarea } from '@porsche-design-system/components-react';
|
|
3
|
+
import { type FormEvent, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
export const Example = () => {
|
|
6
|
+
const [lastSubmittedData, setLastSubmittedData] = useState('none');
|
|
7
|
+
|
|
8
|
+
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
const formData = new FormData(e.currentTarget);
|
|
11
|
+
setLastSubmittedData((formData.get('some-name') as string) || 'none');
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<form onSubmit={handleSubmit} id="some-form">
|
|
17
|
+
<PTextarea name="some-name" label="Some Label"></PTextarea>
|
|
18
|
+
</form>
|
|
19
|
+
<div className="flex gap-fluid-sm mt-fluid-sm">
|
|
20
|
+
<PButton type="submit" form="some-form">
|
|
21
|
+
Submit
|
|
22
|
+
</PButton>
|
|
23
|
+
<PButton type="reset" form="some-form">
|
|
24
|
+
Reset
|
|
25
|
+
</PButton>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<PText>Last submitted data: {lastSubmittedData}</PText>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|