@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,118 @@
|
|
|
1
|
+
# p-button
|
|
2
|
+
|
|
3
|
+
The `p-button` component is essential for performing form or **interaction** events. For an optimal user guidance and dedicated pursuit of business or sales goals, different types of Buttons (**Primary** and **Secondary**) are available for usage. A Button can be used with or without a label but it's recommended to keep the **label visible** for better **usability** whenever possible. When used without a label, it is mandatory for **accessibility** to provide a descriptive label text for screen readers. Whenever you want to provide navigational elements, stick to the [Link](../p-link/p-link.md) component instead.
|
|
4
|
+
|
|
5
|
+
You can use native `click`, `focus`, `focusin`, `blur` and `focusout` events on the `p-button`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
### Do:
|
|
10
|
+
|
|
11
|
+
- Use buttons for actions that have clear consequences, such as submitting a form or initiating a purchase.
|
|
12
|
+
- Use buttons to indicate the next step in a process, such as "Continue" or "Next".
|
|
13
|
+
- Use buttons with clear and concise labels that accurately describe the action they perform.
|
|
14
|
+
- Use the primary button for the most important or desired action, and use the secondary button for less important or secondary actions.
|
|
15
|
+
- Use icons in buttons to enhance their meaning, but ensure the icon is relevant and easily recognizable.
|
|
16
|
+
- Use disabled buttons to indicate actions that are currently unavailable or incomplete, and provide context for why the button is disabled.
|
|
17
|
+
|
|
18
|
+
### Don't:
|
|
19
|
+
|
|
20
|
+
- Don't use buttons for non-actionable elements, such as decorative graphics or text.
|
|
21
|
+
- Don't use ambiguous or unclear labels for buttons, as it can lead to confusion for users.
|
|
22
|
+
- Don't use too many buttons on a page or in a single section, as it can overwhelm users and reduce usability.
|
|
23
|
+
- Don't use primary and secondary buttons interchangeably, as it can confuse users and reduce the clarity of your interface.
|
|
24
|
+
- Don't use disabled buttons without providing context for why the button is disabled. This can lead to confusion and frustration for users.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Related components
|
|
29
|
+
|
|
30
|
+
- [Links](../p-link/p-link.md)
|
|
31
|
+
|
|
32
|
+
## Accessibility support
|
|
33
|
+
|
|
34
|
+
### Keyboard
|
|
35
|
+
|
|
36
|
+
| Key / state | Function |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
39
|
+
| `Enter`, `Space` | Activates the button. |
|
|
40
|
+
| `disabled` | Button still focusable. |
|
|
41
|
+
|
|
42
|
+
### ARIA enhancements
|
|
43
|
+
|
|
44
|
+
#### External **ARIA** provided by the `aria` property:
|
|
45
|
+
|
|
46
|
+
| ARIA | Usage |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `aria-label` | Defines a string value that labels the interactive element. |
|
|
49
|
+
| `aria-description` | Defines a string value that adds a more detailed description of the interactive element. |
|
|
50
|
+
| `aria-expanded` | Exposes a visual state (e.g. expanded/collapsed) of another element. |
|
|
51
|
+
| `aria-pressed` | Exposes the `pressed` state of a toggle button. |
|
|
52
|
+
| `aria-haspopup` | Defines that the button opens a popup (e.g. `dialog`). It can be used in combination with `aria-expanded` to indicate the state of the popup. |
|
|
53
|
+
|
|
54
|
+
#### Internal **ARIA** that is managed by the component:
|
|
55
|
+
|
|
56
|
+
| ARIA | Usage |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `aria-disabled="true"` | When `disabled` prop is set, this ARIA attribute is set on the button element. |
|
|
59
|
+
| `role="status"` | When `loading` prop is set, the component announces the loading state (start and finish). |
|
|
60
|
+
| `aria-hidden="true"` | When the `icon` prop is set, the icon is hidden from the screen reader. |
|
|
61
|
+
|
|
62
|
+
## Limitations
|
|
63
|
+
|
|
64
|
+
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.
|
|
65
|
+
|
|
66
|
+
| ARIA | Support |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `aria-labelledby` | 🚫 |
|
|
69
|
+
| `aria-describedby` | 🚫 |
|
|
70
|
+
| `aria-owns` | 🚫 |
|
|
71
|
+
| `aria-controls` | 🚫 |
|
|
72
|
+
| `aria-activedescendant` | 🚫 |
|
|
73
|
+
|
|
74
|
+
## Development considerations
|
|
75
|
+
|
|
76
|
+
### Labelling
|
|
77
|
+
|
|
78
|
+
If the text of a button does not clearly indicate what the button's behavior is, add a brief, descriptive label using the `aria` property with the `aria-label` value to provide more context for screen reader users. Phrases like "Add", "Detail" or "Show" can be unclear when read out of context by a screen reader. In such instances, provide an alternative text that offers more detailed information, such as "Add item XYZ to shopping cart" or "Details of product XYZ."
|
|
79
|
+
|
|
80
|
+
### Common do's and don'ts
|
|
81
|
+
|
|
82
|
+
- **Do** pass ARIA attributes via the `aria` prop, for example `aria="{ 'aria-haspopup': 'dialog' }"` when opening a dialog.
|
|
83
|
+
- **Do** provide a clear accessible name for icon-only actions via slotted label or `aria` property.
|
|
84
|
+
- **Don't** add native `aria-*` attributes directly on the component host.
|
|
85
|
+
- **Don't** rely on short generic button labels like "Show" or "Add" without context.
|
|
86
|
+
|
|
87
|
+
## API
|
|
88
|
+
|
|
89
|
+
### Properties
|
|
90
|
+
|
|
91
|
+
| Property | Type | Default | Description |
|
|
92
|
+
| --- | --- | --- | --- |
|
|
93
|
+
| `aria` | `ButtonAriaAttribute` | `undefined` | Sets ARIA attributes on the button to improve accessibility for screen readers. |
|
|
94
|
+
| `compact` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Reduces the button's height and padding for denser layouts. Supports responsive breakpoint values. |
|
|
95
|
+
| `disabled` | `boolean` | `false` | Disables the button, preventing all interaction and blocking events. |
|
|
96
|
+
| `form` | `string` | `undefined` | Associates the button with a form element by its ID, so it can submit or reset that form even when placed outside of it. |
|
|
97
|
+
| `hideLabel` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values. |
|
|
98
|
+
| `icon` | `'none'`<br>one of 290 icon names — see [icon names](references/icons.md) | `'none'` | Sets the icon displayed inside the button. Use `none` to show no icon. |
|
|
99
|
+
| `iconSource` | `string` | `undefined` | Sets a path to a custom SVG icon, used instead of the built-in icon set. |
|
|
100
|
+
| `loading` | `boolean` | `false` | Disables the button and replaces its content with a loading spinner to indicate an ongoing operation. |
|
|
101
|
+
| `name` | `string` | `undefined` | Sets the name submitted with the form data when this button triggers form submission. |
|
|
102
|
+
| `type` | `'button'` `'submit'` `'reset'` | `'submit'` | Sets the button's HTML type — `submit` sends the form, `reset` clears it, `button` performs no default action. |
|
|
103
|
+
| `value` | `string` | `undefined` | Sets the value submitted with the form data when this button triggers form submission, paired with `name`. |
|
|
104
|
+
| `variant` | `'primary'` `'secondary'` | `'primary'` | Sets the visual style variant of the button (`primary` or `secondary`). |
|
|
105
|
+
|
|
106
|
+
### Slots
|
|
107
|
+
|
|
108
|
+
| Slot | Required | Allowed tag names | Description |
|
|
109
|
+
| --- | --- | --- | --- |
|
|
110
|
+
| _(default)_ | no | — | Default slot for the button label. |
|
|
111
|
+
|
|
112
|
+
## Examples
|
|
113
|
+
|
|
114
|
+
| Example | When to use | File |
|
|
115
|
+
| --- | --- | --- |
|
|
116
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
117
|
+
| Form | When used as a submit button, the `name` and `value` props are submitted as a pair as part of the form data. | [./examples/Form.tsx](./examples/Form.tsx) |
|
|
118
|
+
| Form Attribute | When a button is used as a submit or reset button outside a form, the `form` attribute can be utilized to explicitly associate the button with a specific form element. | [./examples/FormAttribute.tsx](./examples/FormAttribute.tsx) |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonPure, 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
|
+
<PButtonPure name="option" value="A" type="submit">
|
|
18
|
+
Button A
|
|
19
|
+
</PButtonPure>
|
|
20
|
+
<PButtonPure name="option" value="B" type="submit">
|
|
21
|
+
Button B
|
|
22
|
+
</PButtonPure>
|
|
23
|
+
</form>
|
|
24
|
+
|
|
25
|
+
<PText>Last submitted data: {lastSubmittedData}</PText>
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonPure, 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
|
+
|
|
20
|
+
<div className="flex gap-fluid-sm mt-fluid-sm">
|
|
21
|
+
<PButtonPure type="submit" form="some-form">
|
|
22
|
+
Submit
|
|
23
|
+
</PButtonPure>
|
|
24
|
+
<PButtonPure type="reset" form="some-form">
|
|
25
|
+
Reset
|
|
26
|
+
</PButtonPure>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<PText>Last submitted data: {lastSubmittedData}</PText>
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# p-button-pure
|
|
2
|
+
|
|
3
|
+
The `p-button-pure` component is essential to perform events for **interactions**. A Button can be used with or without a label, but it's recommended to keep the **label visible** for better **usability** whenever possible. When used without a label, it is mandatory for **accessibility** to provide a descriptive label text for screen readers.
|
|
4
|
+
|
|
5
|
+
Whenever you want to provide navigational elements, stick to the [Link](../p-link/p-link.md) or [Link Pure](../p-link-pure/p-link-pure.md) component instead.
|
|
6
|
+
|
|
7
|
+
Similarly to the `p-button`, the `p-button-pure` can be used as a submit button within a form for which a `name` and `value` prop can be passed. See the [Button Form Example](../p-button/p-button.md) for more information.
|
|
8
|
+
|
|
9
|
+
You can use native `click`, `focus`, `focusin`, `blur` and `focusout` events on the `p-button-pure`.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Do:
|
|
14
|
+
|
|
15
|
+
- Use Button Pure as a more subtle call to action or to execute an action.
|
|
16
|
+
- Choose the appropriate variant for your use case, such as Icon and Text or Text only.
|
|
17
|
+
- Use Icon left as the default state and stretch only on small viewports or areas.
|
|
18
|
+
- Keep the label short and include active verbs to indicate the action.
|
|
19
|
+
- Stack Button Pure groups left-aligned to guarantee scannability and legibility.
|
|
20
|
+
|
|
21
|
+
### Don't:
|
|
22
|
+
|
|
23
|
+
- Don't use Button Pure as the primary or only call to action.
|
|
24
|
+
- Don't use long labels that do not give a clear indication of the action.
|
|
25
|
+
- Don't use buttons to link/navigate to other pages. Use regular [Link](../p-link/p-link.md) instead.
|
|
26
|
+
|
|
27
|
+
## Accessibility support
|
|
28
|
+
|
|
29
|
+
### Keyboard
|
|
30
|
+
|
|
31
|
+
| Key / state | Function |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
34
|
+
| `Enter`, `Space` | Activates the button. |
|
|
35
|
+
| `disabled` | Button still focusable. |
|
|
36
|
+
|
|
37
|
+
### ARIA enhancements
|
|
38
|
+
|
|
39
|
+
#### External **ARIA** provided by the `aria` property:
|
|
40
|
+
|
|
41
|
+
| ARIA | Usage |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `aria-label` | Defines a string value that labels the interactive element. |
|
|
44
|
+
| `aria-description` | Defines a string value that adds a more detailed description of the interactive element. |
|
|
45
|
+
| `aria-expanded` | Exposes a visual state (e.g. expanded/collapsed) of another element. |
|
|
46
|
+
| `aria-pressed` | Exposes the `pressed` state of a toggle button. |
|
|
47
|
+
| `aria-haspopup` | Defines that the button opens a popup (e.g. `dialog`). It can be used in combination with `aria-expanded` to indicate the state of the popup. |
|
|
48
|
+
|
|
49
|
+
#### Internal **ARIA** that is managed by the component:
|
|
50
|
+
|
|
51
|
+
| ARIA | Usage |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `aria-disabled="true"` | When `disabled` prop is set, this ARIA attribute is set on the button element. |
|
|
54
|
+
| `role="status"` | When `loading` prop is set, the component announces the loading state (start and finish). |
|
|
55
|
+
| `aria-hidden="true"` | When the `icon` prop is set, the icon is hidden from the screen reader. |
|
|
56
|
+
|
|
57
|
+
## Limitations
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
| ARIA | Support |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `aria-labelledby` | 🚫 |
|
|
64
|
+
| `aria-describedby` | 🚫 |
|
|
65
|
+
| `aria-owns` | 🚫 |
|
|
66
|
+
| `aria-controls` | 🚫 |
|
|
67
|
+
| `aria-activedescendant` | 🚫 |
|
|
68
|
+
|
|
69
|
+
## Development considerations
|
|
70
|
+
|
|
71
|
+
### Labelling
|
|
72
|
+
|
|
73
|
+
If the text of a button does not clearly indicate what the button's behavior is, add a brief, descriptive label using the `aria` property with the `aria-label` value to provide more context for screen reader users. Phrases like "Add," "Detail," or "Show" can be unclear when read out of context by a screen reader. In such instances, provide an alternative text that offers more detailed information, such as "Add item XYZ to shopping cart" or "Details of product XYZ."
|
|
74
|
+
|
|
75
|
+
### Common do's and don'ts
|
|
76
|
+
|
|
77
|
+
- **Do** pass ARIA attributes via the `aria` prop, for example `aria="{ 'aria-haspopup': 'dialog' }"` when opening a dialog.
|
|
78
|
+
- **Do** provide a clear accessible name for icon-only actions via slotted label or `aria` property.
|
|
79
|
+
- **Don't** add native `aria-*` attributes directly on the component host.
|
|
80
|
+
- **Don't** rely on short generic button labels like "Show" or "Add" without context.
|
|
81
|
+
|
|
82
|
+
## API
|
|
83
|
+
|
|
84
|
+
### Properties
|
|
85
|
+
|
|
86
|
+
| Property | Type | Default | Description |
|
|
87
|
+
| --- | --- | --- | --- |
|
|
88
|
+
| `active` | `boolean` | `false` | Visually marks the button as the currently active or selected item, useful for navigation and toggle patterns. |
|
|
89
|
+
| `alignLabel` | `'start'` `'end'`<br>`BreakpointCustomizable<ButtonPureAlignLabel>` | `'end'` | Sets the label position relative to the icon — `start` places it before, `end` places it after. Supports responsive breakpoint values. |
|
|
90
|
+
| `aria` | `ButtonPureAriaAttribute` | `undefined` | Sets ARIA attributes on the button to improve accessibility for screen readers. |
|
|
91
|
+
| `color` | `'primary'` `'contrast-higher'` `'contrast-high'` `'contrast-medium'` `'inherit'` | `'primary'` | Sets the foreground color of the button's icon and label text. |
|
|
92
|
+
| `disabled` | `boolean` | `false` | Disables the button, preventing all interaction and blocking events. |
|
|
93
|
+
| `form` | `string` | `undefined` | Associates the button with a form element by its ID, so it can submit or reset that form even when placed outside of it. |
|
|
94
|
+
| `hideLabel` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values. |
|
|
95
|
+
| `icon` | `''`<br>one of 290 icon names — see [icon names](references/icons.md) | `'arrow-right'` | Sets the icon displayed next to the label. |
|
|
96
|
+
| `iconSource` | `string` | `undefined` | Sets a path to a custom SVG icon, used instead of the built-in icon set. |
|
|
97
|
+
| `loading` | `boolean` | `false` | Disables the button and replaces its icon with a loading spinner to indicate an ongoing operation. |
|
|
98
|
+
| `name` | `string` | `undefined` | Sets the name submitted with the form data when this button triggers form submission. |
|
|
99
|
+
| `size` | `'2xs'` `'xs'` `'sm'` `'md'` `'lg'` `'xl'` `'2xl'` `'3xl'` `'4xl'` `'5xl'` `'inherit'`<br>_deprecated:_ `'xx-small'` `'x-small'` `'small'` `'medium'` `'large'` `'x-large'`<br>`BreakpointCustomizable<ButtonPureSize>` | `'sm'` | Sets the font size of the button label. Supports responsive breakpoint values. |
|
|
100
|
+
| `stretch` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Expands the space between icon and label to fill the full container width. Supports responsive breakpoint values. |
|
|
101
|
+
| `type` | `'button'` `'submit'` `'reset'` | `'submit'` | Sets the button's HTML type — `submit` sends the form, `reset` clears it, `button` performs no default action. |
|
|
102
|
+
| `underline` | `boolean` | `false` | Adds a text underline to the label to reinforce the button's link-like appearance. |
|
|
103
|
+
| `value` | `string` | `undefined` | Sets the value submitted with the form data when this button triggers form submission, paired with `name`. |
|
|
104
|
+
|
|
105
|
+
### Slots
|
|
106
|
+
|
|
107
|
+
| Slot | Required | Allowed tag names | Description |
|
|
108
|
+
| --- | --- | --- | --- |
|
|
109
|
+
| _(default)_ | no | — | Default slot for the button label. |
|
|
110
|
+
|
|
111
|
+
## Examples
|
|
112
|
+
|
|
113
|
+
| Example | When to use | File |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
116
|
+
| Button Pure with custom clickable/focusable area | Sometimes it might be useful to enlarge the clickable/focusable area of a button to fulfill accessibility guidelines. | [./examples/CustomClickableArea.tsx](./examples/CustomClickableArea.tsx) |
|
|
117
|
+
| Form | When used as a submit button, the `name` and `value` props are submitted as a pair as part of the form data. | [./examples/Form.tsx](./examples/Form.tsx) |
|
|
118
|
+
| Form Attribute | When a button is used as a submit or reset button outside a form, the `form` attribute can be utilized to explicitly associate the button with a specific form element. | [./examples/FormAttribute.tsx](./examples/FormAttribute.tsx) |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonTile, PTag } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PButtonTile label="Some label" description="Some Description" gradient={true}>
|
|
8
|
+
<PTag slot="header" color="background-frosted" compact={true} style={{'colorScheme': 'only light'}}>
|
|
9
|
+
Some tag
|
|
10
|
+
</PTag>
|
|
11
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
12
|
+
</PButtonTile>
|
|
13
|
+
</>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonTile, PTag, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PButtonTile label="Some label" description="Some Description" gradient={true}>
|
|
8
|
+
<PTag slot="header" color="background-frosted" compact={true}>
|
|
9
|
+
Some tag
|
|
10
|
+
</PTag>
|
|
11
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
12
|
+
<PText slot="footer">
|
|
13
|
+
Some footer text
|
|
14
|
+
</PText>
|
|
15
|
+
</PButtonTile>
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonTile, PTag, PText } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<div className="grid grid-cols-2 gap-static-md">
|
|
8
|
+
<PButtonTile label="Some label" description="Some Description">
|
|
9
|
+
<PTag slot="header" color="background-frosted" compact={true}>
|
|
10
|
+
Some tag
|
|
11
|
+
</PTag>
|
|
12
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
13
|
+
<PText slot="footer">
|
|
14
|
+
Some footer text
|
|
15
|
+
</PText>
|
|
16
|
+
</PButtonTile>
|
|
17
|
+
<PButtonTile label="Some label" description="Some Description" compact={true}>
|
|
18
|
+
<PTag slot="header" color="background-frosted" compact={true}>
|
|
19
|
+
Some tag
|
|
20
|
+
</PTag>
|
|
21
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
22
|
+
<PText slot="footer">
|
|
23
|
+
Some footer text
|
|
24
|
+
</PText>
|
|
25
|
+
</PButtonTile>
|
|
26
|
+
</div>
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonTile, PSelect, PSelectOption, SelectChangeEventDetail } from '@porsche-design-system/components-react';
|
|
3
|
+
import { Property } from 'csstype';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
|
|
6
|
+
export const Example = () => {
|
|
7
|
+
const [hyphens, setHyphens] = useState<Property.Hyphens>('auto');
|
|
8
|
+
|
|
9
|
+
const onChange = (e: CustomEvent<SelectChangeEventDetail>) => {
|
|
10
|
+
setHyphens(e.detail.value as Property.Hyphens);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<PSelect label="Select hyphens" name="hyphens" value={hyphens} onChange={onChange}>
|
|
16
|
+
<PSelectOption value="auto">style="hyphens: auto;"</PSelectOption>
|
|
17
|
+
<PSelectOption value="manual">style="hyphens: manual;"</PSelectOption>
|
|
18
|
+
<PSelectOption value="none">style="hyphens: none;"</PSelectOption>
|
|
19
|
+
</PSelect>
|
|
20
|
+
|
|
21
|
+
<PButtonTile
|
|
22
|
+
label="Some label"
|
|
23
|
+
description="An extra­ordinarily Porsche"
|
|
24
|
+
compact={true}
|
|
25
|
+
size="inherit"
|
|
26
|
+
style={{ colorScheme: 'dark', maxWidth: '400px', fontSize: '45px', hyphens }}
|
|
27
|
+
className="mt-fluid-sm"
|
|
28
|
+
>
|
|
29
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
30
|
+
</PButtonTile>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonTile, PTag } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<div className="grid grid-cols-2 gap-static-md">
|
|
8
|
+
<PButtonTile aspectRatio="4/3" label="Some Label" description="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum." size="large">
|
|
9
|
+
<PTag slot="header" color="background-frosted" compact="true">
|
|
10
|
+
4/3
|
|
11
|
+
</PTag>
|
|
12
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
13
|
+
</PButtonTile>
|
|
14
|
+
<PButtonTile aspectRatio="4/3" label="Some Label" description="Some description">
|
|
15
|
+
<PTag slot="header" color="background-frosted" compact="true">
|
|
16
|
+
4/3
|
|
17
|
+
</PTag>
|
|
18
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
19
|
+
</PButtonTile>
|
|
20
|
+
<PButtonTile aspectRatio="1/1" label="Some Label" description="Some description">
|
|
21
|
+
<PTag slot="header" color="background-frosted" compact="true">
|
|
22
|
+
1/1
|
|
23
|
+
</PTag>
|
|
24
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
25
|
+
</PButtonTile>
|
|
26
|
+
<PButtonTile aspectRatio="9/16" label="Some Label" description="Some description">
|
|
27
|
+
<PTag slot="header" color="background-frosted" compact="true">
|
|
28
|
+
9/16
|
|
29
|
+
</PTag>
|
|
30
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
31
|
+
</PButtonTile>
|
|
32
|
+
<PButtonTile aspectRatio="1/1" label="Some Label" description="Some description">
|
|
33
|
+
<PTag slot="header" color="background-frosted" compact="true">
|
|
34
|
+
1/1
|
|
35
|
+
</PTag>
|
|
36
|
+
<img src="assets/lights.jpg" alt="Some image description" />
|
|
37
|
+
</PButtonTile>
|
|
38
|
+
</div>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# p-button-tile
|
|
2
|
+
|
|
3
|
+
The `p-button-tile` is an interactive component that displays a provided image to tease content and performs form or **interaction** events within one container. Whenever you want to provide navigational elements, stick to the [Link Tile](../p-link-tile/p-link-tile.md) component instead.
|
|
4
|
+
|
|
5
|
+
**Note:** The component does not take care of processing and aligning the image.
|
|
6
|
+
|
|
7
|
+
An `<img/>`, `<picture/>` or `<video/>` tag has to be provided as default slot.
|
|
8
|
+
|
|
9
|
+
Additionally, the properties `description` and `label` are required. The `description` property is used as a teaser with a more detailed description of the button and its action.
|
|
10
|
+
|
|
11
|
+
The `label` property is used to describe the button.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Do:
|
|
16
|
+
|
|
17
|
+
- Use Button Tile for **on-page interactivity**.
|
|
18
|
+
- Use [Link Tile](../p-link-tile/p-link-tile.md) instead if you want to **navigate** to another page.
|
|
19
|
+
- Use Button Tile with appropriate aspect ratios and short descriptions (80 characters or fewer).
|
|
20
|
+
- Use basic Button Tile for better perception tests and compact Button Tile for improved spacing (especially on mobile).
|
|
21
|
+
- Use gradient Button Tile when image contrast is insufficient and select images with natural contrast.
|
|
22
|
+
- Use font size for visual hierarchy and customize image type and font size for responsiveness.
|
|
23
|
+
- Use engaging verbs and product names in compact Button Tile.
|
|
24
|
+
- Create assets upfront for image processing.
|
|
25
|
+
|
|
26
|
+
### Don't:
|
|
27
|
+
|
|
28
|
+
- Don't manipulate images, keep them natural and contrasted.
|
|
29
|
+
- Don't write long descriptions that overflow content (especially on mobile).
|
|
30
|
+
|
|
31
|
+
## Accessibility support
|
|
32
|
+
|
|
33
|
+
### Keyboard
|
|
34
|
+
|
|
35
|
+
| Key / state | Function |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
38
|
+
| `Enter`, `Space` | Activates the button. |
|
|
39
|
+
| `disabled` | Button still focusable. |
|
|
40
|
+
|
|
41
|
+
### ARIA enhancements
|
|
42
|
+
|
|
43
|
+
#### External **ARIA** provided by the `aria` property:
|
|
44
|
+
|
|
45
|
+
| ARIA | Usage |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `aria-label` | Defines a string value that labels an interactive element. It's required for buttons with `hideLabel="true"`. |
|
|
48
|
+
| `aria-description` | Defines a string value that adds a more detailed description of the interactive element. |
|
|
49
|
+
| `aria-expanded` | Exposes a visual state (e.g. expanded/collapsed) of another element. |
|
|
50
|
+
| `aria-pressed` | Exposes the `pressed` state of a toggle button. |
|
|
51
|
+
| `aria-haspopup` | Defines that the button opens a popup (e.g. `dialog`). It can be used in combination with `aria-expanded` to indicate the state of the popup. |
|
|
52
|
+
|
|
53
|
+
## Limitations
|
|
54
|
+
|
|
55
|
+
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.
|
|
56
|
+
|
|
57
|
+
| ARIA | Support |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| `aria-labelledby` | 🚫 |
|
|
60
|
+
| `aria-describedby` | 🚫 |
|
|
61
|
+
| `aria-owns` | 🚫 |
|
|
62
|
+
| `aria-controls` | 🚫 |
|
|
63
|
+
| `aria-activedescendant` | 🚫 |
|
|
64
|
+
|
|
65
|
+
## Development considerations
|
|
66
|
+
|
|
67
|
+
### Labelling
|
|
68
|
+
|
|
69
|
+
If the text of the button does not clearly indicate what the button's function is, add a brief, descriptive label using the `aria` property with the `aria-label` value to provide more context for screen reader users. Phrases like "Detail" or "Open" can be unclear when read out of context by a screen reader. In such instances, provide an alternative text that offers more detailed information, such as "Open details of product XYZ."
|
|
70
|
+
|
|
71
|
+
### Common do's and don'ts
|
|
72
|
+
|
|
73
|
+
- **Do** pass ARIA attributes via the `aria` prop when the visible label needs more context.
|
|
74
|
+
- **Do** provide a descriptive `label` that explains the tile action.
|
|
75
|
+
- **Do** add `aria-label` on slotted `<video>` elements used as backgrounds.
|
|
76
|
+
- **Don't** add native `aria-*` attributes directly on the component host.
|
|
77
|
+
|
|
78
|
+
## API
|
|
79
|
+
|
|
80
|
+
### Properties
|
|
81
|
+
|
|
82
|
+
| Property | Type | Default | Description |
|
|
83
|
+
| --- | --- | --- | --- |
|
|
84
|
+
| `align` | `'top'` `'bottom'` | `'bottom'` | Controls the vertical placement of the description and button — `top` or `bottom`. |
|
|
85
|
+
| `aria` | `ButtonTileAriaAttribute` | `undefined` | Sets ARIA attributes on the tile's action button to improve accessibility for screen readers. |
|
|
86
|
+
| `aspectRatio` | `'1/1'` `'4/3'` `'3/4'` `'16/9'` `'9/16'` `'auto'`<br>`BreakpointCustomizable<ButtonTileAspectRatio>` | `'4/3'` | Sets the width-to-height ratio of the tile media area. Supports responsive breakpoint values. |
|
|
87
|
+
| `compact` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Renders only the icon button without the full label. Supports responsive breakpoint values. |
|
|
88
|
+
| `description` _(required)_ | `string` | `undefined` | Sets the description text displayed in the tile's content area. |
|
|
89
|
+
| `disabled` | `boolean` | `false` | Disables the tile, preventing button interaction. |
|
|
90
|
+
| `gradient` | `boolean` | `false` | Shows a gradient overlay over the media slot to improve text legibility on bright images or videos. |
|
|
91
|
+
| `icon` | `'none'`<br>one of 290 icon names — see [icon names](references/icons.md) | `'none'` | Sets the icon displayed in the tile's action button. Use `none` to show no icon. |
|
|
92
|
+
| `iconSource` | `string` | `undefined` | Sets a path to a custom SVG icon for the action button, used instead of the built-in icon set. |
|
|
93
|
+
| `label` _(required)_ | `string` | `undefined` | Sets the accessible label text of the action button rendered inside the tile. |
|
|
94
|
+
| `loading` | `boolean` | `false` | Disables the tile and shows a loading spinner to indicate an ongoing operation. |
|
|
95
|
+
| `size` | `'medium'` `'large'` `'inherit'`<br>`BreakpointCustomizable<ButtonTileSize>` | `'medium'` | Sets the font size of the description text in the tile content area. Supports responsive breakpoint values. |
|
|
96
|
+
| `type` | `'button'` `'submit'` `'reset'` | `'submit'` | Sets the button's HTML type — `submit` sends the form, `reset` clears it, `button` performs no default action. |
|
|
97
|
+
| `weight` | `'regular'` `'semi-bold'`<br>`BreakpointCustomizable<ButtonTileWeight>` | `'semi-bold'` | Sets the font weight of the description text in the tile content area. Supports responsive breakpoint values. |
|
|
98
|
+
|
|
99
|
+
### Slots
|
|
100
|
+
|
|
101
|
+
| Slot | Required | Allowed tag names | Description |
|
|
102
|
+
| --- | --- | --- | --- |
|
|
103
|
+
| `header` | no | — | Renders a header section above the content area. |
|
|
104
|
+
| _(default)_ | no | — | Default slot for the img or picture tag. |
|
|
105
|
+
| `footer` | no | — | Renders a footer section below the description. |
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
| Example | When to use | File |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
112
|
+
| UI behaviour | The component is able to break out of its aspect ratio in case content overflows to be accessibility compliant (see first row in example). | [./examples/UiBehaviour.tsx](./examples/UiBehaviour.tsx) |
|
|
113
|
+
| Hyphens | It is possible to overwrite the hyphens style on the host element and use 'soft' hyphens. | [./examples/Hyphens.tsx](./examples/Hyphens.tsx) |
|
|
114
|
+
| Footer slot | You can also use a `footer` slot to display additional text below the description, providing more flexibility for custom content. | [./examples/FooterSlot.tsx](./examples/FooterSlot.tsx) |
|
|
115
|
+
| Color scheme | The component defines `color-scheme: dark` internally, independently of the scheme defined globally or on an ancestor outside the Button Tile. | [./examples/ColorScheme.tsx](./examples/ColorScheme.tsx) |
|