Load More

Pro

Shows the first few items of a long list and adds the rest on demand: one batch per press, everything at once with a way back, or on its own as the reader scrolls. A height clamp with a faded edge covers content that isn't a list of items.

Accordion
Accordion6 variants
Alert
Alert14 variants
Avatar
Avatar5 variants
Badge
Badge12 variants
Breadcrumb
Breadcrumb6 variants
Button
Button16 variants
Button Group
Button Group18 variants
Card
Card7 variants
Carousel
Carousel9 variants
Checkbox
Checkbox8 variants
Command
Command4 variants
Date Picker
Date Picker6 variants
Dialog
Dialog11 variants
Drawer
Drawer8 variants
Dropdown Menu
Dropdown Menu8 variants
Field
Field5 variants
Input
Input10 variants
Select
Select7 variants

Try it yourself. This one is live, and its code is right below.

Laptop and notebook on a desk
Bright workspace with a laptop
Laptop on a wooden desk
Modern studio workspace

Showing 4 of 20

Installation#

# One-time setup (tokens + lib helpers)npx koalaui-cli@latest init# Activate your Pro license (once per machine)npx koalaui-cli@latest login <key># Add this component (its dependencies come along)npx koalaui-cli@latest add load-more

Usage#

This example is part of Koala UI Pro

The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.

Have a license? Unlock it here

Anatomy#

import {  LoadMore,  LoadMoreList,  LoadMoreContent,  LoadMoreStatus,  LoadMoreTrigger,  LoadMoreSentinel,  LoadMoreLoader,  LoadMoreEnd,} from "@/components/ui/load-more"// Count mode<LoadMore total={…} initial={…} step={…}>  <LoadMoreList>…</LoadMoreList>  <LoadMoreSentinel />  <LoadMoreLoader />  <LoadMoreStatus />  <LoadMoreTrigger more="…" less="…" />  <LoadMoreEnd>…</LoadMoreEnd></LoadMore>// Height mode<LoadMore collapsedHeight="…">  <LoadMoreContent>…</LoadMoreContent>  <LoadMoreTrigger more="…" less="…" /></LoadMore>

Load more#

The plainest form: each press adds the next step items and the list stays open. Without less the button leaves once the last item is in, and LoadMoreEnd closes the list in its place.

4.2.0Data Grid lands in the app kitNov 12
4.1.3Toggletip for help behind an info buttonNov 11
4.1.2Layout gains the inset shellNov 10
4.1.1Stepper bars become the defaultNov 8

Show more, show less#

Set step to the total and pass less: one press reveals everything, and the same button rolls to "Show less" and folds the list back to initial. The page scrolls with the fold, so the button stays under the pointer instead of being left far below.

4.2.0Data Grid lands in the app kitNov 12
4.1.3Toggletip for help behind an info buttonNov 11
4.1.2Layout gains the inset shellNov 10
4.1.1Stepper bars become the defaultNov 8

Batches#

initial and step are independent: here four photos show and every press brings eight more, until all twenty are in. LoadMoreStatus keeps count in tabular figures, and with less the last press turns the button into the way back.

Laptop and notebook on a desk
Bright workspace with a laptop
Laptop on a wooden desk
Modern studio workspace

Showing 4 of 20

Infinite scroll#

Add LoadMoreSentinel after the list and batches load on their own as it comes within rootMargin of the scroller's edge. onLoadMore returns the fetch, and LoadMoreLoader shows while it runs. After maxAutoLoads automatic loads the sentinel stops and LoadMoreTrigger appears, so whatever sits below the list can still be reached; a failed fetch hands over to the button the same way.

Marta Vidal#4821 · 1 item
€24.00
Oriol Puig#4820 · 2 items
€61.00
Lucía Ferrer#4819 · 3 items
€98.00
Nil Serra#4818 · 4 items
€135.00
Clara Soler#4817 · 1 item
€172.00
Pau Roca#4816 · 2 items
€29.00
Aina Costa#4815 · 3 items
€66.00
Jan Mas#4814 · 4 items
€103.00
Marta Vidal#4813 · 1 item
€140.00
Oriol Puig#4812 · 2 items
€177.00

Height clamp#

For content that isn't a list of items (an FAQ, a catalog grid, a long page section), leave out total and wrap it in LoadMoreContent: the region is clamped to collapsedHeight, its cut edge fades, and the button reveals the rest with a height transition.

Accordion
Accordion6 variants
Alert
Alert14 variants
Avatar
Avatar5 variants
Badge
Badge12 variants
Breadcrumb
Breadcrumb6 variants
Button
Button16 variants
Button Group
Button Group18 variants
Card
Card7 variants
Carousel
Carousel9 variants
Checkbox
Checkbox8 variants
Command
Command4 variants
Date Picker
Date Picker6 variants
Dialog
Dialog11 variants
Drawer
Drawer8 variants
Dropdown Menu
Dropdown Menu8 variants
Field
Field5 variants
Input
Input10 variants
Select
Select7 variants

Collapsed height#

collapsedHeight sets how much shows before the reveal. Pick a value that cuts through a row rather than landing between two: a clean break reads as the end of the list, which is the opposite of the message you want. The default is 28rem.

Accordion
Accordion6 variants
Alert
Alert14 variants
Avatar
Avatar5 variants
Badge
Badge12 variants
Breadcrumb
Breadcrumb6 variants
Button
Button16 variants
Button Group
Button Group18 variants
Card
Card7 variants
Carousel
Carousel9 variants
Checkbox
Checkbox8 variants
Command
Command4 variants
Date Picker
Date Picker6 variants
Dialog
Dialog11 variants
Drawer
Drawer8 variants
Dropdown Menu
Dropdown Menu8 variants
Field
Field5 variants
Input
Input10 variants
Select
Select7 variants

Alignment#

align moves the button, status, loader and end line: center (the default, which reads as a page-level affordance), start, or end. The button's row is always in flow, never floated over the fade, so opening costs no layout shift of its own.

Accordion
Accordion6 variants
Alert
Alert14 variants
Avatar
Avatar5 variants
Badge
Badge12 variants
Breadcrumb
Breadcrumb6 variants
Button
Button16 variants
Button Group
Button Group18 variants
Card
Card7 variants
Carousel
Carousel9 variants
Checkbox
Checkbox8 variants
Command
Command4 variants
Date Picker
Date Picker6 variants
Dialog
Dialog11 variants
Drawer
Drawer8 variants
Dropdown Menu
Dropdown Menu8 variants
Field
Field5 variants
Input
Input10 variants
Select
Select7 variants

Any surface#

The cut edge fades through the fade-b mask utility rather than a background-coloured gradient panel, so it needs to know nothing about what sits behind it. The same component on a solid brand band cuts correctly with no configuration. With tone="onMedia" the trigger becomes the white chip: on a band it is the only action on the fill, so it takes the light shape.

Accordion6 variants
Alert14 variants
Avatar5 variants
Badge12 variants
Breadcrumb6 variants
Button16 variants
Button Group18 variants
Card7 variants
Carousel9 variants
Checkbox8 variants
Command4 variants
Date Picker6 variants
Dialog11 variants
Drawer8 variants
Dropdown Menu8 variants
Field5 variants
Input10 variants
Select7 variants

Without the fade#

fade={false} keeps the region opaque to the last pixel. Reach for it when a soft edge would misread as "this text trails off": a legal notice, a price list, a data table.

Accordion6 variants
Alert14 variants
Avatar5 variants
Badge12 variants
Breadcrumb6 variants
Button16 variants
Button Group18 variants
Card7 variants
Carousel9 variants
Checkbox8 variants

Open by default#

defaultExpanded opens the clamp on mount, for a deep link that should land on the full list. Pair it with onExpandedChange to react to each toggle.

Accordion
Accordion6 variants
Alert
Alert14 variants
Avatar
Avatar5 variants
Badge
Badge12 variants
Breadcrumb
Breadcrumb6 variants
Button
Button16 variants
Button Group
Button Group18 variants
Card
Card7 variants
Carousel
Carousel9 variants
Checkbox
Checkbox8 variants
Command
Command4 variants
Date Picker
Date Picker6 variants
Dialog
Dialog11 variants
Drawer
Drawer8 variants
Dropdown Menu
Dropdown Menu8 variants
Field
Field5 variants
Input
Input10 variants
Select
Select7 variants

API reference#

LoadMore

The root. Passing total, hasMore or onLoadMore puts it in count mode, which reveals items in batches through LoadMoreList; without them it is a height clamp around LoadMoreContent. Renders a <div>, forwards its props, and announces each new batch through a polite live region. Every part accepts className, merged last.

PropTypeDefaultDescription
totalnumber-Count mode: how many items exist. Drives hasMore and the status line.
initialnumber6Count mode: how many items show before the first load, and where "Show less" returns to.
stepnumberinitialCount mode: how many items each load adds. Set it to total for a one-press reveal.
onLoadMore({ count, step }) => void | Promise<unknown>-Called before each batch. Return a promise to fetch: the trigger shows a spinner (or LoadMoreLoader shows, for automatic loads) and the batch appears when it resolves. A rejection keeps the count and hands control back to the button.
hasMoreboolean-Count mode with an unknown total, e.g. cursor pagination. Overrides the count < total check.
collapsedHeightstring"28rem"Height mode: the clamp, any CSS length. Pick one that cuts through a row, so the fade reads as more below.
defaultExpandedbooleanfalseHeight mode: start revealed.
onExpandedChange(expanded: boolean) => void-Called when the region opens or closes; in count mode, when the last batch lands and when it folds back.
align"center" | "start" | "end""center"Where the trigger, status, loader and end line sit.
Data attributeDescription
data-modecount or height.
aria-busyPresent while a fetch from onLoadMore is pending.

LoadMoreList

Count mode: renders the first count of its children. Pass the items straight in (a mapped array, not wrapped in a fragment). The list opens to fit each batch the way an accordion does, the new items fade in together, and the first of them takes focus after a press.

Data attributeDescription
data-expandedPresent once every item is showing.

LoadMoreStatus

The count line, "Showing 12 of 48", in tabular figures so it never jiggles. Renders a <p>.

PropTypeDefaultDescription
children(shown: number, total?: number) => React.ReactNode-Replace the wording. Defaults to the loadMoreStatus label.

LoadMoreTrigger

The button. Its icon follows what a press does: a button that adds a batch (count mode, no less) leads with a spinning loader ring; a button that reveals and folds back (less, or height mode) ends with a caret that turns over. Wires aria-expanded and aria-controls, keeps focus through a fetch (it never disables), and steps aside while a sentinel loads on its own. Forwards Button props, children aside.

PropTypeDefaultDescription
moreReact.ReactNode"Load more"Label while there is more to show. Name what is below, e.g. "Older releases".
lessReact.ReactNode-Label once everything shows. Pass it to fold back to the start; leave it out and the button leaves when the list is complete.
variantButtonProps["variant"]"outline"Defaults to secondary, the solid chip, under an onMedia or onInverse tone.

LoadMoreSentinel

Infinite scroll: an invisible line after the list, watched by an IntersectionObserver rooted on the nearest scroll container (the viewport when there is none). Each time it comes within reach, the next batch loads.

PropTypeDefaultDescription
rootMarginstring"0px 0px 240px 0px"How far ahead to start loading. A bottom margin loads before the reader hits the end.
thresholdnumber | number[]0How much of the sentinel must be in view. Leave at 0 for a 1px line.
maxAutoLoadsnumberInfinityAutomatic loads before the button takes over, so a footer below stays reachable.

LoadMoreLoader

Shows while an automatic load is fetching. Defaults to a spinner and the loadingMore label; pass children to replace them.

LoadMoreContent

Height mode: the clamped region; put the long grid or list straight inside. Forwards native <div> props.

PropTypeDefaultDescription
fadebooleantrueDissolves the cut edge while collapsed. Skipped when the content already fits.
Data attributeDescription
data-expandedPresent while the region is revealed.
CSS variableDescription
--fade-sizeDepth of the dissolve, min(16rem, 40%) here. Override per instance, e.g. [--fade-size:6rem].

LoadMoreEnd

Count mode: a closing line once every item has loaded, rendered only if the reader loaded at least once. Defaults to the loadMoreEnd label.

FAQ#

Count mode when the content is a list of like items you can number: photos, rows, results. It renders only what shows, can fetch the next batch, and counts. Height mode when the content is one block that just runs long, like an FAQ or a section grid: everything is in the DOM and the clamp is purely visual.