PullRefresh <pm-pull-refresh>
Pull down from the top of a list or page to reload it on touch screens, with a spinner while it refreshes.
Overview
Wrap the scrolling content: the element scrolls itself when it has a height (style="block-size: 30rem"), otherwise it follows the page scroll. Pulling past threshold and letting go fires pm-refresh; pass your reload to event.detail.waitUntil(fetch(...)) and the spinner stays until it settles (or set refreshing yourself and clear it). It stops the browser's own pull-to-reload inside it. Pulling needs touch, so also offer another way to refresh for mouse and keyboard users: <pm-button commandfor="feed" command="--refresh"> or refresh().
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
refreshing | boolean | false | A refresh is running (spinner shown). |
threshold | number | 72 | Pixels to pull before letting go refreshes. |
disabled | boolean | false | Turn pulling off. |
label | string | Refreshing… | Announced while refreshing. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-refresh | onPmRefresh | The user pulled to refresh. Pass your work to detail.waitUntil(promise): the spinner stays until it settles. |
Slots
| Slot | Description |
|---|---|
(default) | The scrolling content. |
CSS parts
| Part | Description |
|---|---|
::part(indicator) | The circle with the arrow or spinner. |
Methods
refresh()