Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Load More

ProNew

The end of a growing list: a count, a bar showing how much is loaded and a button, with optional loading on scroll.

Installation

pnpm dlx shadcn@latest add @viewport/load-more

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
shown*number

How many items are shown now, and how many there are in all.

—
total*number—
onLoadMore*() => void

Runs when more items are wanted.

—
loadingbooleanfalse
autoboolean

Load the next page when the control scrolls into view, instead of waiting for a press. The button stays, as a fallback.

false
nounstring

What the items are, e.g. "contacts".

"results"
classNamestring—

Accessibility

  • The button remains when loading on scroll is on, so there is always a manual way.
  • The count is announced when more rows arrive.
  • The button stays focusable while it loads.