Duolith docs

PullToRefresh

Content that is refreshed when it is pulled down from the top, such as a feed, with a spinner while it refreshes and a Refresh button that does the same.

Stability: experimental

Props

PropTypeDefaultMeans
labelstring"Refresh"The Refresh button's text.
refreshingbooleanbindable(false)Whether a refresh is running. It is set while onRefresh runs; bind it with bind:refreshing={name} to show one started elsewhere.
onRefresh() => void | Promise<void>Refreshes the content; the spinner shows until the promise it returns settles. A pull while one runs starts none.

Children

The content that is refreshed.

States

StateLooks like
idleA small Refresh button above the content.
refreshingA spinner in place of the button, and the status reads Refreshing.

Accessibility

rolestatus for the refreshing message; the button is a button
nameThe label prop names the button; the spinner is named Refreshing.
focusTab reaches the Refresh button, then the content.
keyboardEnter and Space press Refresh.
notesA swipe down counts only while what scrolls around it is at the top, so scrolling up a feed never refreshes it. The pull is never the only way: the button does the same.

Theme tokens

color.muted space.2 space.3 radius.full text.caption

Example

<PullToRefresh onRefresh={reload}><List items={posts} /></PullToRefresh>