Skip to content

Processing

<loomi-processing> — a process indicator with processing (spinner), success and failed states. Best used inside a <loomi-modal> while an async task runs, switching state (and title/message) once it resolves.

Terminal window
npm install @loomidev/processing lit
import "@loomidev/processing";
<loomi-processing title="Uploading…" message="Please wait."></loomi-processing>
<loomi-processing state="processing" title="Deleting pending payment"></loomi-processing>
<loomi-processing state="success" title="Done!" message="Pending payment was deleted successfully."></loomi-processing>
<loomi-processing state="failed" title="Failed" message="Pending payment could not be deleted."></loomi-processing>

The spinner color (only relevant in the processing state) accepts any loomi color.

<loomi-processing color="success" title="Uploading…"></loomi-processing>

A typical pattern shows <loomi-processing> inside a modal while an API call runs, then swaps state based on the result.

<loomi-modal name="delete-payment" show-action-buttons="false">
<loomi-processing id="delete-status" state="processing" title="Deleting pending payment"></loomi-processing>
</loomi-modal>
<script type="module">
import { showLoomiModal } from "@loomidev/modal";
async function deletePayment(id) {
const status = document.getElementById("delete-status");
status.state = "processing";
status.title = "Deleting pending payment";
showLoomiModal("delete-payment");
try {
await fetch(`/payments/${id}`, { method: "DELETE" });
status.state = "success";
status.title = "Done!";
status.message = "Pending payment was deleted successfully.";
} catch {
status.state = "failed";
status.title = "Failed";
status.message = "Pending payment could not be deleted.";
}
}
</script>

For the library-wide baseline, see Foundations — Accessibility.

For the shared container and viewport rules, see Foundations — Responsive behavior.

For theme activation, token overrides, and contrast guidance, see Foundations — Dark mode.

AttributeDefaultDescription
stateprocessingprocessing | success | failed
title(blank)Heading text.
message(blank)Supporting text.
colorprimarySpinner color (processing state).
<loomi-processing
id="status"
state="processing"
title="Deleting pending payment"
message="This will only take a moment."
color="error"
></loomi-processing>

<loomi-processing> is a standard custom element, so the browser can use it in plain HTML, Blade, React, Vue, Angular, Svelte, Astro, and most other frameworks. The important beginner rule is: install the package, import it once before the tag is rendered, then write the Loomi tag in your template.

Run install commands from the app where you want to use this component. That means the folder that contains that app’s package.json. Do not run these install commands from packages/processing unless you are editing LoomiUI itself.

Terminal window
cd /path/to/your-app
npm install @loomidev/processing lit

If you are contributing to LoomiUI itself, first move to the top-level components folder. That is where the main package.json for all packages lives, and pnpm --filter ... commands should be run from there:

Terminal window
cd /path/to/your-copy-of-loomiui/components
pnpm --filter @loomidev/processing build
pnpm --filter @loomidev/processing typecheck

Use the CDN version for prototypes, documentation pages, or a quick reproduction. The import map tells the browser where to find Lit, which Loomi components use internally.

<script type="importmap">
{ "imports": { "lit": "https://esm.sh/lit@3.3.3", "lit/": "https://esm.sh/lit@3.3.3/" } }
</script>
<script type="module" src="https://esm.sh/@loomidev/processing"></script>
<loomi-processing state="loading" title="Uploading" message="Please wait while the file is saved."></loomi-processing>

In Vite, Webpack, Parcel, Rollup, or a framework build pipeline, install the package and import it once in your main app JavaScript file. After that, you can use the Loomi tag anywhere in your app.

import "@loomidev/processing";

Run the install command from your Laravel project root, then import the component in resources/js/app.js. If your project uses Laravel Vite, npm run dev and npm run build should also be run from the Laravel project root.

Terminal window
cd /path/to/your-laravel-app
npm install @loomidev/processing lit
npm run dev
resources/js/app.js
import "@loomidev/processing";
<loomi-processing state="loading" title="Uploading" message="Please wait while the file is saved."></loomi-processing>

React can render Loomi tags directly. If you are on React 18, or if you need to pass arrays, objects, or functions, use a ref and assign those values after the component mounts.

import "@loomidev/processing";
export function LoomiExample() {
return (
<loomi-processing state="loading" title="Uploading" message="Please wait while the file is saved."></loomi-processing>
);
}

If TypeScript does not recognize the Loomi tag in JSX, add it to your app’s JSX type declarations.

Import the package in the component that uses it, or once in your main Vue file. Vue templates can use Loomi tags directly. For arrays, objects, or functions, pass the value as a JavaScript property instead of as plain text.

<script setup>
import "@loomidev/processing";
</script>
<template>
<loomi-processing state="loading" title="Uploading" message="Please wait while the file is saved."></loomi-processing>
</template>

If Vue warns that the tag is an unknown component, configure compilerOptions.isCustomElement for tags that start with loomi- in your Vite or Vue config.

Import the package once and tell Angular to allow custom HTML tags with CUSTOM_ELEMENTS_SCHEMA. For NgModule apps, add the schema to the module instead of the standalone component.

app.component.ts
import { CUSTOM_ELEMENTS_SCHEMA, Component } from "@angular/core";
import "@loomidev/processing";
@Component({
selector: "app-root",
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<loomi-processing state="loading" title="Uploading" message="Please wait while the file is saved."></loomi-processing>
`,
})
export class AppComponent {}

Svelte can import the package inside a component script. Astro can import it in the frontmatter of the page or layout where the tag appears.

<script>
import "@loomidev/processing";
</script>
<loomi-processing state="loading" title="Uploading" message="Please wait while the file is saved."></loomi-processing>
---
import "@loomidev/processing";
---
<loomi-processing state="loading" title="Uploading" message="Please wait while the file is saved."></loomi-processing>

Frameworks such as Next.js, Nuxt, SvelteKit, and Astro sometimes render HTML on the server before browser-only code runs. If your framework complains, move the Loomi import to client-side code. In Next.js, that usually means a component with "use client"; in Nuxt, it often means a .client.ts plugin.

  • @loomidev/core
  • @loomidev/icons