@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,189 @@
|
|
|
1
|
+
# p-table
|
|
2
|
+
|
|
3
|
+
The `p-table` component displays tabular data and offers column-wise sorting options. It combines a consistent appearance together with great accessibility while not having restrictions regarding its content. Therefore, it can be used for plain text but also rich content like images, form elements and buttons.
|
|
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 to display and compare structured data in rows and columns.
|
|
12
|
+
- Use as a tool to query consume and navigate to specific data.
|
|
13
|
+
- Use if there are at least two or more columns of data parameters.
|
|
14
|
+
- Ensure that the column headers are relevant to the data it represents and are succinct.
|
|
15
|
+
- Include rich content in the cell data to support the specific requirements of the application use cases.
|
|
16
|
+
- Enable sorting of columns in ascending or descending order with an arrow icon to indicate the order direction.
|
|
17
|
+
- Ensure that the table is responsive and stretches to the full available width.
|
|
18
|
+
- Include a table caption describing the contents of the table for accessibility
|
|
19
|
+
- Use the built-in scroller for horizontal scrolling on mobile viewports.
|
|
20
|
+
|
|
21
|
+
### Don't:
|
|
22
|
+
|
|
23
|
+
- Don't use for non-structured data or data that can be presented in a simpler format.
|
|
24
|
+
- Don't overuse or clutter cell data with unnecessary content.
|
|
25
|
+
- Don't neglect to include a table caption for accessibility purposes.
|
|
26
|
+
|
|
27
|
+
## Accessibility support
|
|
28
|
+
|
|
29
|
+
### Keyboard
|
|
30
|
+
|
|
31
|
+
| Key / state | Function |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) sort button. |
|
|
34
|
+
| `Enter`, `Space` | Changes sorting direction. |
|
|
35
|
+
|
|
36
|
+
### ARIA enhancements
|
|
37
|
+
|
|
38
|
+
#### Internal **ARIA** that is managed by the component:
|
|
39
|
+
|
|
40
|
+
| ARIA | Usage |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `aria-label="STRING"`, `aria-labelledby="IDREF"` | Captions are provided by aria labels. |
|
|
43
|
+
| `aria-sort="VALUE"` | Provides the sorting direction of the column header. |
|
|
44
|
+
|
|
45
|
+
## Development considerations
|
|
46
|
+
|
|
47
|
+
### Common do's and don'ts
|
|
48
|
+
|
|
49
|
+
- **Do** provide a `caption` or `slot="caption"` that describes the table purpose.
|
|
50
|
+
- **Do** keep visible header text for sortable columns.
|
|
51
|
+
- **Don't** use `hide-label` on a sortable column without an alternative accessible name.
|
|
52
|
+
|
|
53
|
+
## Tests
|
|
54
|
+
|
|
55
|
+
### Automated
|
|
56
|
+
|
|
57
|
+
| Technology | Support |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| AXE-Core (WCAG 2.2 AA, Best-Practice) | ✅ |
|
|
60
|
+
| High-Contrast Mode (light/dark) | ✅ |
|
|
61
|
+
| Text-Zoom (200%) | ✅ |
|
|
62
|
+
|
|
63
|
+
### Manual
|
|
64
|
+
|
|
65
|
+
| Technology | Support |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| Keyboard | ✅ |
|
|
68
|
+
| Screen reader (VoiceOver, NVDA) | 🟠 (Partially supported, [Safari issues 1](https://adrianroselli.com/2022/07/its-mid-2022-and-browsers-mostly-safari-still-break-accessibility-via-display-properties.html), [Safari issues 2](https://adrianroselli.com/2018/02/tables-css-display-properties-and-aria.html)) |
|
|
69
|
+
|
|
70
|
+
## API
|
|
71
|
+
|
|
72
|
+
### Properties
|
|
73
|
+
|
|
74
|
+
| Property | Type | Default | Description |
|
|
75
|
+
| --- | --- | --- | --- |
|
|
76
|
+
| `caption` | `string` | `undefined` | Sets a screen-reader-only accessible caption that describes the table's content; it is not visible in the browser. Use an element with `slot="caption"` for a visible caption instead. |
|
|
77
|
+
| `compact` | `boolean` | `false` | Reduces the cell padding and spacing for a more condensed table layout in data-dense UIs. |
|
|
78
|
+
| `layout` | `'auto'` `'fixed'` | `'auto'` | Controls the CSS `table-layout` algorithm: `auto` sizes columns to fit their content, `fixed` distributes width equally. |
|
|
79
|
+
| `sticky` _(experimental)_ | `boolean` | `false` | @experimental Makes the scroll position indicator sticky at the viewport edge while scrolling, indicating overflow in the table. |
|
|
80
|
+
|
|
81
|
+
### Events
|
|
82
|
+
|
|
83
|
+
| Event | Type | Description |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `update` | `CustomEvent<TableUpdateEventDetail>`<br>`{ id: string; active?: boolean; direction?: Direction }` | Emitted when the user clicks a sortable column header, carrying the new sort configuration in the event detail. |
|
|
86
|
+
|
|
87
|
+
### Slots
|
|
88
|
+
|
|
89
|
+
| Slot | Required | Allowed tag names | Description |
|
|
90
|
+
| --- | --- | --- | --- |
|
|
91
|
+
| `caption` | no | — | Shows a caption that describes the content of the table. |
|
|
92
|
+
| _(default)_ | no | — | Default slot for the table content. |
|
|
93
|
+
|
|
94
|
+
### CSS Variables
|
|
95
|
+
|
|
96
|
+
| CSS Variable | Default | Description |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `--p-table-scroll-indicator-top` | `0px` | Defines the distance from the top of the viewport at which the scroll indicator sticks when scrolling down and `sticky` is enabled. |
|
|
99
|
+
| `--p-table-scroll-indicator-bottom` | `0px` | Defines the distance from the bottom of the viewport at which the scroll indicator sticks when scrolling up and `sticky` is enabled. |
|
|
100
|
+
|
|
101
|
+
## Sub-components
|
|
102
|
+
|
|
103
|
+
These tags are only valid inside the parent(s) listed under each one — often this component, but some are shared and list a different parent (e.g. a tag documented here via a common ancestor). Their APIs come from the same authoritative `component-meta` as the parent above.
|
|
104
|
+
|
|
105
|
+
### `p-table-body`
|
|
106
|
+
|
|
107
|
+
Allowed parent: `p-table`.
|
|
108
|
+
|
|
109
|
+
#### Slots
|
|
110
|
+
|
|
111
|
+
| Slot | Required | Allowed tag names | Description |
|
|
112
|
+
| --- | --- | --- | --- |
|
|
113
|
+
| _(default)_ | no | — | Default slot for the table body content. |
|
|
114
|
+
|
|
115
|
+
### `p-table-cell`
|
|
116
|
+
|
|
117
|
+
Allowed parent: `p-table-row`.
|
|
118
|
+
|
|
119
|
+
#### Properties
|
|
120
|
+
|
|
121
|
+
| Property | Type | Default | Description |
|
|
122
|
+
| --- | --- | --- | --- |
|
|
123
|
+
| `multiline` | `boolean` | `false` | Allows slotted text to wrap onto multiple lines instead of being forced onto a single line. |
|
|
124
|
+
|
|
125
|
+
#### Slots
|
|
126
|
+
|
|
127
|
+
| Slot | Required | Allowed tag names | Description |
|
|
128
|
+
| --- | --- | --- | --- |
|
|
129
|
+
| _(default)_ | no | — | Default slot for the table cell content. |
|
|
130
|
+
|
|
131
|
+
### `p-table-head`
|
|
132
|
+
|
|
133
|
+
Allowed parent: `p-table`.
|
|
134
|
+
|
|
135
|
+
#### Slots
|
|
136
|
+
|
|
137
|
+
| Slot | Required | Allowed tag names | Description |
|
|
138
|
+
| --- | --- | --- | --- |
|
|
139
|
+
| _(default)_ | no | — | Default slot for the table head content. |
|
|
140
|
+
|
|
141
|
+
### `p-table-head-cell`
|
|
142
|
+
|
|
143
|
+
Allowed parents: `p-table-head-row`, `p-table-row`.
|
|
144
|
+
|
|
145
|
+
#### Properties
|
|
146
|
+
|
|
147
|
+
| Property | Type | Default | Description |
|
|
148
|
+
| --- | --- | --- | --- |
|
|
149
|
+
| `hideLabel` | `boolean` | `false` | Hides the visible column label while keeping it accessible to screen readers. Only applies when `sort` is not set. |
|
|
150
|
+
| `multiline` | `boolean` | `false` | Allows the column header text to wrap onto multiple lines instead of being truncated to a single line. |
|
|
151
|
+
| `sort` | `TableHeadCellSort` | `undefined` | Configures sorting behavior for this column by providing an `id`, `active` state, and current `direction` (`asc` or `desc`). |
|
|
152
|
+
|
|
153
|
+
#### Slots
|
|
154
|
+
|
|
155
|
+
| Slot | Required | Allowed tag names | Description |
|
|
156
|
+
| --- | --- | --- | --- |
|
|
157
|
+
| _(default)_ | no | — | Default slot for the table head cell content. |
|
|
158
|
+
|
|
159
|
+
### `p-table-head-row`
|
|
160
|
+
|
|
161
|
+
Allowed parent: `p-table-head`.
|
|
162
|
+
|
|
163
|
+
#### Slots
|
|
164
|
+
|
|
165
|
+
| Slot | Required | Allowed tag names | Description |
|
|
166
|
+
| --- | --- | --- | --- |
|
|
167
|
+
| _(default)_ | no | — | Default slot for the table head row content. |
|
|
168
|
+
|
|
169
|
+
### `p-table-row`
|
|
170
|
+
|
|
171
|
+
Allowed parents: `p-table-body`, `p-table-head`.
|
|
172
|
+
|
|
173
|
+
#### Slots
|
|
174
|
+
|
|
175
|
+
| Slot | Required | Allowed tag names | Description |
|
|
176
|
+
| --- | --- | --- | --- |
|
|
177
|
+
| _(default)_ | no | — | Default slot for the table row content. |
|
|
178
|
+
|
|
179
|
+
## Examples
|
|
180
|
+
|
|
181
|
+
| Example | When to use | File |
|
|
182
|
+
| --- | --- | --- |
|
|
183
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
184
|
+
| Caption via Property | A caption that describes the content of the table is mandatory to fulfill accessibility criteria. | [./examples/CaptionProperty.tsx](./examples/CaptionProperty.tsx) |
|
|
185
|
+
| Caption via Slot | Instead of using the the property, the table's caption can be provided via the `caption` slot. | [./examples/CaptionSlot.tsx](./examples/CaptionSlot.tsx) |
|
|
186
|
+
| Layout: fixed | By setting `layout` to `fixed`, you can take full control over each column width, which would otherwise be controlled by its content. | [./examples/LayoutFixed.tsx](./examples/LayoutFixed.tsx) |
|
|
187
|
+
| Sortable Columns | The `p-table`'s column headers can be configured by setting properties on each `p-table-head-cell`. | [./examples/Sorting.tsx](./examples/Sorting.tsx) |
|
|
188
|
+
| Hide Column Label | Sometimes you want to hide the visible label of a `p-table-head-cell`, for example when the column's content is self-explanatory. | [./examples/HideLabel.tsx](./examples/HideLabel.tsx) |
|
|
189
|
+
| Advanced Table | The appearance of a table's contents can be customized as illustrated in the following example. | [./examples/Advanced.tsx](./examples/Advanced.tsx) |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTabs, PTabsItem, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PTabs activeTabIndex={1} aria={{'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist'}}>
|
|
8
|
+
<PTabsItem label="Tab One">
|
|
9
|
+
<PText>
|
|
10
|
+
Tab Content One
|
|
11
|
+
</PText>
|
|
12
|
+
</PTabsItem>
|
|
13
|
+
<PTabsItem label="Tab Two">
|
|
14
|
+
<PText>
|
|
15
|
+
Tab Content Two
|
|
16
|
+
</PText>
|
|
17
|
+
</PTabsItem>
|
|
18
|
+
<PTabsItem label="Tab Three">
|
|
19
|
+
<PText>
|
|
20
|
+
Tab Content Three
|
|
21
|
+
</PText>
|
|
22
|
+
</PTabsItem>
|
|
23
|
+
</PTabs>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTabs, PTabsItem, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PTabs aria={{'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist'}}>
|
|
8
|
+
<PTabsItem label="Tab One">
|
|
9
|
+
<PText>
|
|
10
|
+
Tab Content One
|
|
11
|
+
</PText>
|
|
12
|
+
</PTabsItem>
|
|
13
|
+
<PTabsItem label="Tab Two">
|
|
14
|
+
<PText>
|
|
15
|
+
Tab Content Two
|
|
16
|
+
</PText>
|
|
17
|
+
</PTabsItem>
|
|
18
|
+
<PTabsItem label="Tab Three">
|
|
19
|
+
<PText>
|
|
20
|
+
Tab Content Three
|
|
21
|
+
</PText>
|
|
22
|
+
</PTabsItem>
|
|
23
|
+
</PTabs>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTabs, PTabsItem, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PTabs aria={{'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist'}}>
|
|
8
|
+
<PTabsItem label="Tab 1">
|
|
9
|
+
<PText>
|
|
10
|
+
Tab Content 1
|
|
11
|
+
</PText>
|
|
12
|
+
</PTabsItem>
|
|
13
|
+
<PTabsItem label="Tab 2">
|
|
14
|
+
<PText>
|
|
15
|
+
Tab Content 2
|
|
16
|
+
</PText>
|
|
17
|
+
</PTabsItem>
|
|
18
|
+
<PTabsItem label="Tab 3">
|
|
19
|
+
<PText>
|
|
20
|
+
Tab Content 3
|
|
21
|
+
</PText>
|
|
22
|
+
</PTabsItem>
|
|
23
|
+
<PTabsItem label="Tab 4">
|
|
24
|
+
<PText>
|
|
25
|
+
Tab Content 4
|
|
26
|
+
</PText>
|
|
27
|
+
</PTabsItem>
|
|
28
|
+
<PTabsItem label="Tab 5">
|
|
29
|
+
<PText>
|
|
30
|
+
Tab Content 5
|
|
31
|
+
</PText>
|
|
32
|
+
</PTabsItem>
|
|
33
|
+
<PTabsItem label="Tab 6">
|
|
34
|
+
<PText>
|
|
35
|
+
Tab Content 6
|
|
36
|
+
</PText>
|
|
37
|
+
</PTabsItem>
|
|
38
|
+
<PTabsItem label="Tab 7">
|
|
39
|
+
<PText>
|
|
40
|
+
Tab Content 7
|
|
41
|
+
</PText>
|
|
42
|
+
</PTabsItem>
|
|
43
|
+
<PTabsItem label="Tab 8">
|
|
44
|
+
<PText>
|
|
45
|
+
Tab Content 8
|
|
46
|
+
</PText>
|
|
47
|
+
</PTabsItem>
|
|
48
|
+
<PTabsItem label="Tab 9">
|
|
49
|
+
<PText>
|
|
50
|
+
Tab Content 9
|
|
51
|
+
</PText>
|
|
52
|
+
</PTabsItem>
|
|
53
|
+
<PTabsItem label="Tab 10">
|
|
54
|
+
<PText>
|
|
55
|
+
Tab Content 10
|
|
56
|
+
</PText>
|
|
57
|
+
</PTabsItem>
|
|
58
|
+
<PTabsItem label="Tab 11">
|
|
59
|
+
<PText>
|
|
60
|
+
Tab Content 11
|
|
61
|
+
</PText>
|
|
62
|
+
</PTabsItem>
|
|
63
|
+
<PTabsItem label="Tab 12">
|
|
64
|
+
<PText>
|
|
65
|
+
Tab Content 12
|
|
66
|
+
</PText>
|
|
67
|
+
</PTabsItem>
|
|
68
|
+
<PTabsItem label="Tab 13">
|
|
69
|
+
<PText>
|
|
70
|
+
Tab Content 13
|
|
71
|
+
</PText>
|
|
72
|
+
</PTabsItem>
|
|
73
|
+
<PTabsItem label="Tab 14">
|
|
74
|
+
<PText>
|
|
75
|
+
Tab Content 14
|
|
76
|
+
</PText>
|
|
77
|
+
</PTabsItem>
|
|
78
|
+
<PTabsItem label="Tab 15">
|
|
79
|
+
<PText>
|
|
80
|
+
Tab Content 15
|
|
81
|
+
</PText>
|
|
82
|
+
</PTabsItem>
|
|
83
|
+
<PTabsItem label="Tab 16">
|
|
84
|
+
<PText>
|
|
85
|
+
Tab Content 16
|
|
86
|
+
</PText>
|
|
87
|
+
</PTabsItem>
|
|
88
|
+
<PTabsItem label="Tab 17">
|
|
89
|
+
<PText>
|
|
90
|
+
Tab Content 17
|
|
91
|
+
</PText>
|
|
92
|
+
</PTabsItem>
|
|
93
|
+
<PTabsItem label="Tab 18">
|
|
94
|
+
<PText>
|
|
95
|
+
Tab Content 18
|
|
96
|
+
</PText>
|
|
97
|
+
</PTabsItem>
|
|
98
|
+
<PTabsItem label="Tab 19">
|
|
99
|
+
<PText>
|
|
100
|
+
Tab Content 19
|
|
101
|
+
</PText>
|
|
102
|
+
</PTabsItem>
|
|
103
|
+
<PTabsItem label="Tab 20">
|
|
104
|
+
<PText>
|
|
105
|
+
Tab Content 20
|
|
106
|
+
</PText>
|
|
107
|
+
</PTabsItem>
|
|
108
|
+
</PTabs>
|
|
109
|
+
</>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTabs, PTabsItem, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PTabs aria={{'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist'}}>
|
|
8
|
+
<PTabsItem label="Tab One">
|
|
9
|
+
<PText>
|
|
10
|
+
Tab Content One
|
|
11
|
+
</PText>
|
|
12
|
+
</PTabsItem>
|
|
13
|
+
<PTabsItem label="Tab Two">
|
|
14
|
+
<PText>
|
|
15
|
+
Tab Content Two
|
|
16
|
+
</PText>
|
|
17
|
+
</PTabsItem>
|
|
18
|
+
<PTabsItem label="Tab Three">
|
|
19
|
+
<PText>
|
|
20
|
+
Tab Content Three
|
|
21
|
+
</PText>
|
|
22
|
+
</PTabsItem>
|
|
23
|
+
</PTabs>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# p-tabs
|
|
2
|
+
|
|
3
|
+
The `p-tabs` component makes it easy to explore and switch between different views. You can organize and allow navigation between groups of content that are related and at the same level of hierarchy. The component handles the display of content according to the active tab and all accessibility attributes on your tab and tab content.
|
|
4
|
+
|
|
5
|
+
This variant does not support `a` tags and should not be used for navigation. If you need to update your window location have a look at [Tabs Bar](../p-tabs-bar/p-tabs-bar.md) component.
|
|
6
|
+
|
|
7
|
+
Basic implementation shows a tab list with buttons to switch between the content. For every `p-tabs-item` inside of the `p-tabs` component, a tab will be created. The assigned `label` property defines also the name of the button.
|
|
8
|
+
|
|
9
|
+
Every `p-tabs-item` holds a `slot` to display content which can be individually assigned.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Do:
|
|
14
|
+
|
|
15
|
+
- Use when there is a large amount of content that can be separated.
|
|
16
|
+
- Use to make the content accessible without reloading the page or compromising on space.
|
|
17
|
+
|
|
18
|
+
### Don't:
|
|
19
|
+
|
|
20
|
+
- Don't place more than six tabs within a group.
|
|
21
|
+
- Don't use more than two words for a tab label whenever possible.
|
|
22
|
+
- Don't use it for primary navigation.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Related Component
|
|
27
|
+
|
|
28
|
+
- [Tabs Bar](../p-tabs-bar/p-tabs-bar.md)
|
|
29
|
+
|
|
30
|
+
## Accessibility support
|
|
31
|
+
|
|
32
|
+
### Keyboard
|
|
33
|
+
|
|
34
|
+
| Key / state | Function |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `Tab` | - Moves focus to the active tab. - When the tab list contains the focus, moves focus to the next element in the tab sequence, which is the `tabpanel` element. |
|
|
37
|
+
| `Right Arrow`, `Left Arrow` | - Moves focus to the next tab. - Activates the newly focused tab. - If focus is on the last tab, moves focus to the first tab. |
|
|
38
|
+
| `Home`, `End` | - Moves focus to the first/last tab and activates it. |
|
|
39
|
+
|
|
40
|
+
### ARIA enhancements
|
|
41
|
+
|
|
42
|
+
#### External **ARIA** provided by the `aria` property:
|
|
43
|
+
|
|
44
|
+
| ARIA | Usage |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `aria-label="STRING"` | Defines a string value that labels the tablist. |
|
|
47
|
+
| `aria-description="STRING"` | Defines a string value that adds a more detailed description of the tablist. |
|
|
48
|
+
|
|
49
|
+
#### Internal **ARIA** that is managed by the component:
|
|
50
|
+
|
|
51
|
+
| ARIA | Usage |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `role="tablist"` | Indicates that the element serves as a container for a set of tabs. |
|
|
54
|
+
| `role="tab"` | Indicates the button serves as a tab control. |
|
|
55
|
+
| `role="tabpanel"` | Indicates the `tabs-item` serves as a container for tabpanel content. |
|
|
56
|
+
| `aria-label="STRING"` | Adds accessible name to the `tabs-item` based on the `label` property. |
|
|
57
|
+
| `aria-selected="BOOLEAN"` | Indicates whether the tab is selected and whether its associated tabpanel is visible. |
|
|
58
|
+
|
|
59
|
+
## Development considerations
|
|
60
|
+
|
|
61
|
+
### Labelling
|
|
62
|
+
|
|
63
|
+
When multiple tab groups appear on the same page, or when the purpose of the tabs is not clear from the visible tab labels alone, provide a descriptive accessible name for the tablist using the `aria` property, e.g.: `<p-tabs aria="{ 'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist' }">`.
|
|
64
|
+
|
|
65
|
+
### Common do's and don'ts
|
|
66
|
+
|
|
67
|
+
- **Do** pass tablist ARIA through the `aria` prop when multiple tab groups appear on one page.
|
|
68
|
+
- **Do** use specific `label` text on each `p-tabs-item`.
|
|
69
|
+
- **Don't** add native `aria-*` attributes directly on the component host.
|
|
70
|
+
- **Don't** use vague tab labels like "Details" without context.
|
|
71
|
+
|
|
72
|
+
## Limitations
|
|
73
|
+
|
|
74
|
+
Due to the nature of **Web Components** and **shadow DOM**, there are limitations when using some **ARIA** attributes to define relationships between elements across different shadow DOMs or shadow DOM/light DOM combinations.
|
|
75
|
+
|
|
76
|
+
| ARIA | Support |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `aria-controls` | 🚫 |
|
|
79
|
+
|
|
80
|
+
## API
|
|
81
|
+
|
|
82
|
+
### Properties
|
|
83
|
+
|
|
84
|
+
| Property | Type | Default | Description |
|
|
85
|
+
| --- | --- | --- | --- |
|
|
86
|
+
| `activeTabIndex` | `number` | `0` | Sets the zero-based index of the currently active tab; update this prop to switch tabs programmatically. |
|
|
87
|
+
| `aria` | `TabsAriaAttribute` | `undefined` | Sets ARIA attributes on the tablist, such as `aria-label` and `aria-description`. |
|
|
88
|
+
| `background` | `'canvas'` `'surface'` `'frosted'` `'none'` | `'none'` | Sets the background color of the tabs bar. Use `frosted` only when placed on top of images, videos, or gradients. |
|
|
89
|
+
| `compact` | `boolean` | `undefined` | Reduces the tab height and padding for use in dense layouts where vertical space is limited. |
|
|
90
|
+
| `size` | `'small'` `'medium'`<br>`BreakpointCustomizable<TabsSize>` | `'small'` | Sets the font size of the tab labels using the PDS typographic scale. Supports responsive breakpoint values. |
|
|
91
|
+
| `weight` _(deprecated)_ | `'regular'` `'semi-bold'` | `'regular'` | @deprecated Will be removed in the next major release. Has no effect anymore. |
|
|
92
|
+
|
|
93
|
+
### Events
|
|
94
|
+
|
|
95
|
+
| Event | Type | Description |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `update` | `CustomEvent<TabsUpdateEventDetail>`<br>`{ activeTabIndex: number }` | Emitted when the user switches to a different tab, carrying the new `activeTabIndex` in the event detail. |
|
|
98
|
+
|
|
99
|
+
### Controlled properties
|
|
100
|
+
|
|
101
|
+
- `activeTabIndex` — a controlled prop, but the component also updates it internally. Listen for the `update` event to observe changes; you do not have to write the value back.
|
|
102
|
+
|
|
103
|
+
### Slots
|
|
104
|
+
|
|
105
|
+
| Slot | Required | Allowed tag names | Description |
|
|
106
|
+
| --- | --- | --- | --- |
|
|
107
|
+
| _(default)_ | no | — | Default slot for the `p-tabs-item` tags. |
|
|
108
|
+
|
|
109
|
+
## Sub-components
|
|
110
|
+
|
|
111
|
+
These tags are only valid inside the parent(s) listed under each one — often this component, but some are shared and list a different parent (e.g. a tag documented here via a common ancestor). Their APIs come from the same authoritative `component-meta` as the parent above.
|
|
112
|
+
|
|
113
|
+
### `p-tabs-item`
|
|
114
|
+
|
|
115
|
+
Allowed parent: `p-tabs`.
|
|
116
|
+
|
|
117
|
+
#### Properties
|
|
118
|
+
|
|
119
|
+
| Property | Type | Default | Description |
|
|
120
|
+
| --- | --- | --- | --- |
|
|
121
|
+
| `label` _(required)_ | `string` | `undefined` | Sets the label text displayed in the tab navigation button that the user clicks to activate this tab's content. |
|
|
122
|
+
|
|
123
|
+
#### Slots
|
|
124
|
+
|
|
125
|
+
| Slot | Required | Allowed tag names | Description |
|
|
126
|
+
| --- | --- | --- | --- |
|
|
127
|
+
| _(default)_ | no | — | Default slot for the tab content. |
|
|
128
|
+
|
|
129
|
+
## Examples
|
|
130
|
+
|
|
131
|
+
| Example | When to use | File |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
134
|
+
| Gradient color | If the amount of tabs exceeds the viewport, the component renders arrow-buttons to help with horizontal scrolling. | [./examples/Gradient.tsx](./examples/Gradient.tsx) |
|
|
135
|
+
| Active Tab | You may need to change the initial active tab. | [./examples/ActiveTab.tsx](./examples/ActiveTab.tsx) |
|
|
136
|
+
| Labelling | Use the `aria` property to provide an accessible name and optional description for the tablist. | [./examples/Labelling.tsx](./examples/Labelling.tsx) |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PTabsBar, type TabsBarUpdateEventDetail } from '@porsche-design-system/components-react';
|
|
4
|
+
|
|
5
|
+
export const Example = () => {
|
|
6
|
+
const [activeTabIndex, setActiveTabIndex] = useState(0);
|
|
7
|
+
|
|
8
|
+
const onUpdate = (e: CustomEvent<TabsBarUpdateEventDetail>) => {
|
|
9
|
+
setActiveTabIndex(e.detail.activeTabIndex);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<PTabsBar activeTabIndex={activeTabIndex} aria={{'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist'}} onUpdate={onUpdate}>
|
|
15
|
+
<button type="button">
|
|
16
|
+
Tab One
|
|
17
|
+
</button>
|
|
18
|
+
<button type="button">
|
|
19
|
+
Tab Two
|
|
20
|
+
</button>
|
|
21
|
+
<button type="button">
|
|
22
|
+
Tab Three
|
|
23
|
+
</button>
|
|
24
|
+
</PTabsBar>
|
|
25
|
+
</>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PTabsBar, type TabsBarUpdateEventDetail } from '@porsche-design-system/components-react';
|
|
4
|
+
|
|
5
|
+
export const Example = () => {
|
|
6
|
+
const [activeTabIndex, setActiveTabIndex] = useState(0);
|
|
7
|
+
|
|
8
|
+
const onUpdate = (e: CustomEvent<TabsBarUpdateEventDetail>) => {
|
|
9
|
+
setActiveTabIndex(e.detail.activeTabIndex);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<PTabsBar activeTabIndex={activeTabIndex} aria={{'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist'}} onUpdate={onUpdate}>
|
|
15
|
+
<button type="button">
|
|
16
|
+
Tab 0
|
|
17
|
+
</button>
|
|
18
|
+
<button type="button">
|
|
19
|
+
Tab 1
|
|
20
|
+
</button>
|
|
21
|
+
<button type="button">
|
|
22
|
+
Tab 2
|
|
23
|
+
</button>
|
|
24
|
+
<button type="button">
|
|
25
|
+
Tab 3
|
|
26
|
+
</button>
|
|
27
|
+
<button type="button">
|
|
28
|
+
Tab 4
|
|
29
|
+
</button>
|
|
30
|
+
<button type="button">
|
|
31
|
+
Tab 5
|
|
32
|
+
</button>
|
|
33
|
+
<button type="button">
|
|
34
|
+
Tab 6
|
|
35
|
+
</button>
|
|
36
|
+
<button type="button">
|
|
37
|
+
Tab 7
|
|
38
|
+
</button>
|
|
39
|
+
<button type="button">
|
|
40
|
+
Tab 8
|
|
41
|
+
</button>
|
|
42
|
+
<button type="button">
|
|
43
|
+
Tab 9
|
|
44
|
+
</button>
|
|
45
|
+
<button type="button">
|
|
46
|
+
Tab 10
|
|
47
|
+
</button>
|
|
48
|
+
<button type="button">
|
|
49
|
+
Tab 11
|
|
50
|
+
</button>
|
|
51
|
+
<button type="button">
|
|
52
|
+
Tab 12
|
|
53
|
+
</button>
|
|
54
|
+
<button type="button">
|
|
55
|
+
Tab 13
|
|
56
|
+
</button>
|
|
57
|
+
<button type="button">
|
|
58
|
+
Tab 14
|
|
59
|
+
</button>
|
|
60
|
+
<button type="button">
|
|
61
|
+
Tab 15
|
|
62
|
+
</button>
|
|
63
|
+
<button type="button">
|
|
64
|
+
Tab 16
|
|
65
|
+
</button>
|
|
66
|
+
<button type="button">
|
|
67
|
+
Tab 17
|
|
68
|
+
</button>
|
|
69
|
+
<button type="button">
|
|
70
|
+
Tab 18
|
|
71
|
+
</button>
|
|
72
|
+
<button type="button">
|
|
73
|
+
Tab 19
|
|
74
|
+
</button>
|
|
75
|
+
</PTabsBar>
|
|
76
|
+
</>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PTabsBar, type TabsBarUpdateEventDetail } from '@porsche-design-system/components-react';
|
|
4
|
+
|
|
5
|
+
export const Example = () => {
|
|
6
|
+
const [activeTabIndex, setActiveTabIndex] = useState(0);
|
|
7
|
+
|
|
8
|
+
const onUpdate = (e: CustomEvent<TabsBarUpdateEventDetail>) => {
|
|
9
|
+
setActiveTabIndex(e.detail.activeTabIndex);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<PTabsBar activeTabIndex={activeTabIndex} aria={{'aria-label': 'Some label for the tablist', 'aria-description': 'Some description for the tablist'}} onUpdate={onUpdate}>
|
|
15
|
+
<button type="button">
|
|
16
|
+
Tab One
|
|
17
|
+
</button>
|
|
18
|
+
<button type="button">
|
|
19
|
+
Tab Two
|
|
20
|
+
</button>
|
|
21
|
+
<button type="button">
|
|
22
|
+
Tab Three
|
|
23
|
+
</button>
|
|
24
|
+
</PTabsBar>
|
|
25
|
+
</>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTabsBar } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PTabsBar>
|
|
8
|
+
<a href="https://porsche.com/page-1">
|
|
9
|
+
Page One
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://porsche.com/page-2">
|
|
12
|
+
Page Two
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://porsche.com/page-3">
|
|
15
|
+
Page Three
|
|
16
|
+
</a>
|
|
17
|
+
</PTabsBar>
|
|
18
|
+
</>
|
|
19
|
+
)
|
|
20
|
+
}
|