Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@ ion-list-header,css-prop,--color,ios
ion-list-header,css-prop,--color,md
ion-list-header,css-prop,--inner-border-width,ios
ion-list-header,css-prop,--inner-border-width,md
ion-list-header,part,inner

ion-loading,scoped
ion-loading,prop,animated,boolean,true,false,false
Expand Down
4 changes: 3 additions & 1 deletion core/src/components/list-header/list-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import type { Color } from '../../interface';

/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*
* @part inner - The inner container element that wraps the list header content.
*/
@Component({
tag: 'ion-list-header',
Expand Down Expand Up @@ -40,7 +42,7 @@ export class ListHeader implements ComponentInterface {
[`list-header-lines-${lines}`]: lines !== undefined,
})}
>
<div class="list-header-inner">
<div class="list-header-inner" part="inner">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would this be considered inner instead of content?

<slot></slot>
</div>
</Host>
Expand Down
34 changes: 34 additions & 0 deletions core/src/components/list-header/test/custom/list-header.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

/**
* This behavior does not vary across modes/directions
*/
configs({ directions: ['ltr'], modes: ['md'] }).forEach(({ title, config }) => {
test.describe(title('list-header: custom'), () => {
test.describe(title('CSS shadow parts'), () => {
test('should be able to customize inner part', async ({ page }) => {
await page.setContent(
`
<style>
ion-list-header::part(inner) {
background-color: red;
}
</style>

<ion-list-header>Header</ion-list-header>
`,
config
);

const header = page.locator('ion-list-header');
const backgroundColor = await header.evaluate((el) => {
const shadowRoot = el.shadowRoot;
const inner = shadowRoot?.querySelector('.list-header-inner');
return inner ? window.getComputedStyle(inner).backgroundColor : '';
});
expect(backgroundColor).toBe('rgb(255, 0, 0)');
});
});
});
});
Loading