Extra
PullToRefresh
A FormaUI pull-to-refresh container — wraps a scrollable layout and adds a swipe-down-to-refresh gesture, delegating to Material 3's stable PullToRefreshBox with fully hoisted isRefreshing state and a styling-passthrough indicator slot.
import dev.formaui.components.pulltorefresh.FormaPullToRefresh
Preview
This toggle is site chrome only — the preview has its own light/dark switch inside.
Live preview — ~37 MB development build
Usage
var refreshing by remember { mutableStateOf(false) }val scope = rememberCoroutineScope()FormaPullToRefresh( isRefreshing = refreshing, onRefresh = { refreshing = true scope.launch { delay(1500); refreshing = false } },) { LazyColumn(Modifier.fillMaxSize()) { items(items) { item -> FormaListItem(headline = item) } }}
FormaPullToRefresh
Wraps a scrollable BoxScope content with a pull-down-to-refresh gesture; the caller hoists isRefreshing and reacts in onRefresh. The indicator slot defaults to Material 3's themed PullToRefreshDefaults.Indicator aligned to the top-center (the styling passthrough).
Supporting API
- rememberPullToRefreshStatefunction (Material 3)
- The component defines no state type of its own — callers may create and own the pull state via Material 3's rememberPullToRefreshState; when omitted, FormaPullToRefresh remembers one internally.
Accessibility
Inherits Material 3's PullToRefreshBox gesture and indicator behavior; drive isRefreshing from your data-load state so the spinning indicator reflects the actual busy state.