Skip to content

Commit 36203f4

Browse files
feat(components): add part body to the post-accordion-item .accordion-body shadowdom element (#6205)
1 parent c5d4b89 commit 36203f4

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.changeset/popular-wombats-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@swisspost/design-system-components': minor
3+
---
4+
5+
Added the `part="body"` attribute to the `post-accordion-item .accordion-body` shadowdom element, so it is possible to override the implemented styles.

packages/components/src/components/post-accordion-item/post-accordion-item.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { HEADING_LEVELS, HeadingLevel } from '@/types';
44
import { checkEmptyOrOneOf } from '@/utils';
55

66
/**
7+
* @part accordion-item - The container element that wraps the entire accordion item.
8+
* @part body - The container element that holds the accordion item's content.
79
* @slot header - Slot for placing custom content within the accordion item's header.
810
* @slot default - Slot for placing content within the accordion item's body.
911
*/
@@ -86,7 +88,7 @@ export class PostAccordionItem {
8688
collapsed={this.collapsed}
8789
ref={el => (this.collapsible = el)}
8890
>
89-
<div class="accordion-body">
91+
<div class="accordion-body" part="body">
9092
<slot />
9193
</div>
9294
</post-collapsible>

packages/components/src/components/post-accordion-item/readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ Type: `Promise<boolean>`
4242

4343
## Shadow Parts
4444

45-
| Part | Description |
46-
| ------------------ | ----------- |
47-
| `"accordion-item"` | |
45+
| Part | Description |
46+
| ------------------ | -------------------------------------------------------------- |
47+
| `"accordion-item"` | The container element that wraps the entire accordion item. |
48+
| `"body"` | The container element that holds the accordion item's content. |
4849

4950

5051
## Dependencies

0 commit comments

Comments
 (0)