loader
Creates a loader instance to show a loading state to the user.
Usage

const loader = await io
.loader({
title: 'Processing',
description: 'Please wait while we process your request...',
})
.start()
try {
await performLongRunningTask()
} finally {
await loader.stop()
}Props
| Prop | Description | Type | Required | Default |
|---|---|---|---|---|
| title | Title of the loading operation | string | Yes | — |
| description | Optional description of the loading operation | string | No | undefined |
Returns
Returns a Loader instance with start() and stop() methods. Both methods are async and return the loader instance for chaining.
Examples
Basic loader usage
const loader = await io
.loader({
title: 'Uploading Files',
description: 'Upload in progress...',
})
.start()
try {
await uploadFiles()
await loader.stop()
} catch (error) {
await loader.stop()
throw error
}Separate start and stop
const loader = io.loader({
title: 'Processing Data',
description: 'This may take a while...',
})
// Start the loader explicitly
await loader.start()
try {
await processData()
} finally {
// Always stop the loader, even if an error occurs
await loader.stop()
}