Show More

View as Markdown

A list's footer: how many show, and a button for the next page that waits while it loads.

  • #4120 Harborview Supply$48.00
  • #4119 Halvorsen & Co$85.00
  • #4118 Okafor Studio$122.00
  • #4117 Rivera Bakery$159.00
  • #4116 Lindqvist Design$196.00
  • #4115 Tanaka Freight$233.00
  • #4114 Mendes Clinic$270.00
  • #4113 Novak Print$307.00
Showing 8 of 23 orders

When to use

A list's footer: how many show, and a button for the next page that waits while it loads. Use Pagination instead when people jump to a page, not just the next one.

Usage

import { ShowMore } from "./ui/uicontext/components/ShowMore.ts"
export const Footer = <M>(h: Html.H<M>, shown: number, loading: boolean, more: M) =>	ShowMore(h, { shown, total: 134, noun: "order", step: 20, loading, onMore: more })

Examples

Cut short in place

moreLabel writes “Ada, Tomás, and 5 more” in English; align: "center" stacks the count over the button.

Watching: Ada Okafor, Tomás García, and 5 more

  • Ada Okafor
  • Tomás García
  • Priya Raman
Showing 3 of 7 watchers

API reference

Options

ShowMore options
NameTypeDescription
shownrequirednumberHow many show now.
totalnumberHow many there are, when it's known.
nounrequiredstringWhat they are, singular: "order". The plural adds an s; give nouns otherwise.
nounsstring—
onMorerequiredMessageLoads or shows the next page.
stepnumberHow many the next page adds; the button says "Show 20 more".
loadingbooleanThe next page is on its way.
align"split" | "center"The count above the button, centered, instead of beside it.
localestring—
styleStyle—

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/show-more

Source