Inner loading
newA loading overlay for one region, with content that cannot be used until it is done.
Profile
Shown on your public page.
Installation
Usage
<script setup lang="ts">
import { Card } from '@/components/ui/card'
import { InnerLoading, InnerLoadingContent, InnerLoadingOverlay } from '@/components/ui/inner-loading'
</script>
<template>
<InnerLoading :loading="saving">
<InnerLoadingContent>
<Card>…</Card>
</InnerLoadingContent>
<InnerLoadingOverlay class="rounded-xl bg-card/70" />
</InnerLoading>
</template>
InnerLoading is the box the overlay fills and takes loading; it sets no aria-busy, since the covered content is already inert. InnerLoadingContent holds what is covered and turns inert while loading, so the mouse, touch, the keyboard and screen readers all stop at the scrim; the wrapper is display: contents, so it adds no box of its own. InnerLoadingOverlay is mounted only while loading, fades in and out, and centres its slot, a Spinner by default.
The scrim is bg-background/70. Over a card, pass bg-card/70 and the card's radius, rounded-xl at the default size, so the overlay matches the surface under it; blur, if you want it, is a backdrop-blur-* class on the same part.
When loading ends, focus goes back to the control that had it, so a keyboard user who pressed Save lands on Save again rather than on the page.
Examples
Label
Anything in the overlay's slot sits in a centred column and is announced as a status.
Files
- quarterly-report.pdf
- team-photo.jpg
- roadmap.key
- budget.xlsx
API Reference
Each part also accepts class, merged over its base classes.
InnerLoading
| Prop | Default | Type and description |
|---|---|---|
| loading | false | booleanWhether the region is loading. While |
| Slot | Scope and description |
|---|---|
| default | any
|
InnerLoadingContent
| Slot | Scope and description |
|---|---|
| default | anyThe content that is covered. The wrapper is |
InnerLoadingOverlay
| Slot | Scope and description |
|---|---|
| default | anyThe indicator and, optionally, a label, read out through |
Props
- loading
false booleanWhether the region is loading. Whiletruethe content is inert and the overlay is shown; when it turnsfalse, focus returns to the control that had it.
Slots
- default
anyInnerLoadingContentandInnerLoadingOverlay.
Slots
- default
anyThe content that is covered. The wrapper isdisplay: contents, so it adds no box of its own.
Slots
- default
anyThe indicator and, optionally, a label, read out throughrole="status". ASpinnerby default.
Data attributes
| data-slot | Attributes | Description |
|---|---|---|
| inner-loading | — | The box the overlay fills. |
| inner-loading-content | inert | The covered content, inert while loading. |
| inner-loading-overlay | — | The scrim with the indicator; present only while loading. |