Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Navigation

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.

Full screen
Inbox Refresh

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/button'; import '@prismora/elements/list'; import '@prismora/elements/pull-refresh'; import { registerIcons } from '@prismora/elements/icon'; import { mail, refresh } from '@prismora/icons'; registerIcons([mail, refresh]); </script> <div class="pm-card" style="inline-size: min(100%, 26rem); padding: 0; overflow: hidden"> <div class="pm-cluster" style="justify-content: space-between; padding: var(--pm-space-3) var(--pm-space-4); border-block-end: 1px solid var(--pm-color-border)"> <strong>Inbox</strong> <pm-button size="sm" variant="ghost" icon-start="refresh" commandfor="pr-demo" command="--refresh">Refresh</pm-button> </div> <pm-pull-refresh style="block-size: 16rem" id="pr-demo"> <pm-list divided label="Messages"> <pm-list-item heading="Ada Lovelace" description="The engine notes are ready" icon-start="mail"></pm-list-item> <pm-list-item heading="Grace Hopper" description="Compiler meeting moved to 3pm" icon-start="mail"></pm-list-item> <pm-list-item heading="Alan Turing" description="Re: the test" icon-start="mail"></pm-list-item> <pm-list-item heading="Katherine Johnson" description="Trajectory figures attached" icon-start="mail"></pm-list-item> </pm-list> </pm-pull-refresh> </div>

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

AttributeTypeDefaultDescription
refreshingbooleanfalseA refresh is running (spinner shown).
thresholdnumber72Pixels to pull before letting go refreshes.
disabledbooleanfalseTurn pulling off.
labelstringRefreshing…Announced while refreshing.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-refreshonPmRefreshThe user pulled to refresh. Pass your work to detail.waitUntil(promise): the spinner stays until it settles.

Slots

SlotDescription
(default)The scrolling content.

CSS parts

PartDescription
::part(indicator)The circle with the arrow or spinner.

Methods

refresh()

Used in templates

Inbox