LoadMore

LoadMore

HkLoadMore is the unified bottom indicator of a dynamically loaded list: a ruled strip with one control in the middle, and three states that share one height. idle is a ghost "Load more" button; loading is the same button wearing its own spinner; end replaces it with a muted sentence (a fixed string, no count in it) and keeps the counter beside it. It exists so cruise panels, tables and feeds stop each inventing their own "there is more" line, and so the affordance does not jump when the state changes under the user's finger.

  • This is the indicator, not the loader. It renders a control and emits loadMore; the page state, the request and the item list are yours.
  • The component that turns the indicator into a whole infinite-list tail — skeleton rows while a page is in flight, an invisible sentinel when scrolling decides instead of a button — is InfiniteTail. That tail composes this component in its manual mode and in its end state, so the two pages describe the same strip from two sides.
  • For a wait that is not "more of the same list" — a first load with no rows yet — use SkeletonList instead; the tail already picks between the two for you.
  • The counter beside the button reads shown / total. When you have no authoritative total, leave it out: the mono counter with a guessed denominator is worse than no counter.

Import

tsx
1
import { HkLoadMore } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // LoadMore, LoadMoreState, load_more_label
use hikari_components::prelude::*; // LoadMoreProps, rsx!, VNode, EventHandler

The Rust form is a plain function, LoadMore(LoadMoreProps { … }); inside rsx! the element form is LoadMore { … } and every prop may be omitted. Vue's loadMore emit is on_load_more there, and the state string is the LoadMoreState enum — Idle (the default), Loading, End.

The three states

The state is a prop, not internal: the component never decides to leave idle. idle renders a ghost sm-sized button with a chevron-down glyph and emits loadMore on press. loading renders the same button with its built-in spinner — no second spinner is swapped in, the affordance morphs in place and the strip keeps a stable height. end renders no button at all, just the end note, and the note is a role="status" region so the change is announced without stealing focus.

shown and total are the delivered and full item counts. Both must be present for the counter to render — one alone is ignored rather than printed as 3 / undefined. In the end state the counter stays: the mirror's end sentence is a fixed string, so 19 / 19 renders beside it. Vue folds the total into the sentence instead ([D] — see the last section).

3 / 19
3 / 19
All 19 items listed

Idle, in flight, and exhausted — the strip keeps one height through all three.

The Rust Button inside the mirror forces disabled while loading is set (Vue's disabled || loading), so the loading state cannot be pressed twice: the request is already in flight and a second press would ask for the same window.

The end note and the counter

The end note's text depends on what the caller knows. With a count above zero it is the localized "All {n} items listed" sentence; with no count at all it degrades to the plain "All items listed". Vue falls back to shown when total is absent, so a list that only counts what it delivered still gets a number — and it passes 0 through as "no count", because "All 0 items listed" reads like an error rather than a finish.

The counter is deliberately not the end note's twin: it renders only in idle and loading, where it is progress ("3 / 19"), and it is ordinary text rather than a second status region, so it is read in place of, not instead of, the button's name.

All items listed
All items listed

[D] The Rust mirror has no useI18n fallback chain: load_more_label reads the same components.hk.loadMore.* keys with the same English fallbacks Vue ships, but it has no {n} substitution for the end note — the mirror's end label is fixed, so a Rust end state announces the reached-the-end sentence and its counter text (19 / 19) separately rather than folding the total into the sentence. A Rust host that wants the Vue sentence builds it with load_more_count_text and renders it in its own node.

Wiring it to a page

In manual mode the button is the trigger: the page has no scroll sentinel, and the user asks for the next window explicitly. That is the right shape when the list is short, when the request is expensive, or when the surrounding page already has a scroll owner that must not be hijacked.

The two mechanisms are alternatives, not layers — mount an HkLoadMore or an auto tail under a list, not both, or a page that scrolls to the bottom both fires the sentinel and shows a button for the same next page. One flag pair is enough here: the example below reads end when everything has arrived, loading while the timer stands in for a request, and idle otherwise — the same derivation InfiniteTail documents, with exhausted winning over busy and one busy flag covering both the first page and every later one.

api-prod-01
Delivered rows stay on screen while the next window loads.
api-prod-02
Delivered rows stay on screen while the next window loads.
2 / 5

The Rust example carries the same two delivered rows and the strip reading 2 / 5; the button's press is the host's, so the snapshot shows the state the Vue example starts from.

API

Vue

Props

NameTypeDefaultRequired
state<code>String as PropType<"idle" | "loading" | "end"></code>"idle"—
shownNumberundefined—
totalNumberundefined—

Emits

EventPayload
loadMore—

Rust

Props — LoadMore

PropTypeDefaultDescription
stateLoadMoreStateLoadMoreState::IdleThe indicator state (Vue default idle).
shownOption<u32>NoneDelivered item count — with total, renders the progress counter.
totalOption<u32>NoneFull item count behind the windowed list.
on_load_moreOption<EventHandler<()>>NoneVue's loadMore emit.

Accessibility

  • The idle and loading control is one real <button> with an aria-label that follows its state — "Load more" or "Loading…" — so a spinner that has replaced the label is still described. While loading the button is also disabled and aria-busy, so it cannot be pressed twice and the busy state is announced.
  • The end note is a role="status" element: it is announced when it appears, without moving focus, which is exactly right for "the list is finished". It is plain muted text otherwise — no button, no tab stop.
  • The two rules flanking the strip are aria-hidden, so the accessible content of the strip is the control and the counter and nothing else.
  • The counter is ordinary text ("3 / 19"); screen readers read it after the button. Do not put the only number there — a user who cannot see the strip needs the end note to carry the total, which it does.
  • The component adds no live region of its own in the idle state, so a page that appends rows after loadMore should announce the arrival on the list region (aria-busy on the container that owns it), not here.

Related components

  • InfiniteTail — the infinite-list tail that renders this component in manual mode and in its end state.
  • SkeletonList — the placeholder rows a tail draws while a page is in flight.
  • CardList — the list surface these strips usually sit under.
  • Table — the other common host: a table with windowed data puts this strip under its last row.
  • Spinner — the bare busy indicator, for waits that are not "more rows".