Skip to main content
You can display a loading indicator to inform users on a slow connection that their search is still in progress. Use InstantSearch’s status indicator to decide when to show a loading indicator. The status can be one of the following:
  • loading: The search is in progress.
  • stalled: The search is in progress, but the response is taking longer than expected.
  • error: The search failed.
  • idle: The search succeeded.
Best practice is to display a loading indicator only when status is stalled, not during a standard (fast) search. Tweak the timing of the stalled status by setting the stalledSearchDelay option. You can then use this condition to display a loading indicator:
Vue
<template>
  <ais-state-results>
    <template v-slot="{ status }">
      <p v-show="status === 'stalled'">
        Loading search results
      </p>
    </template>
  </ais-state-results>
</template>
If you want the loading indicator to display as soon as the search starts, use the loading status in combination with stalled:
Vue
<template>
  <ais-state-results>
    <template v-slot="{ status }">
      <p v-show="status === 'loading' || status === 'stalled'">
        Loading search results
      </p>
    </template>
  </ais-state-results>
</template>
⌘I