Components
Load More
A button that loads the next page and shows the count.
Showing 20 of 84 results
<LoadMore shown={shown} total={84} onLoadMore={loadMore} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/load-more.jsonimport { LoadMore } from "@/components/load-more"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
"Showing 20 of 84 results" with a progress bar and a Load more button, which goes away once everything is shown. The count is announced when it changes.
import { LoadMore } from "@/components/load-more";
export function Results({ items, total, loadMore, loading }: Props) {
return <LoadMore shown={items.length} total={total} loading={loading} onLoadMore={loadMore} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
shown | number | How many are shown. | |
total | number | How many there are. | |
loading | boolean | false | Shows Loading… and disables the button. |
onLoadMore | () => void | Called on click. | |
noun | string | "results" | What's being listed. |
className | string | Classes for the root element. |
With reduced motion, the bar fills without animating.