Inner loading

new

A loading overlay for one region, with content that cannot be used until it is done.

Demo

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.

Label

Files

  • quarterly-report.pdf
  • team-photo.jpg
  • roadmap.key
  • budget.xlsx
Syncing files…

API Reference

Each part also accepts class, merged over its base classes.

Data attributes

data-slotAttributesDescription
inner-loading—The box the overlay fills.
inner-loading-contentinertThe covered content, inert while loading.
inner-loading-overlay—The scrim with the indicator; present only while loading.

Changelog

  1. registry 0.23.0

    bc6008b — Exits now use the decelerating curve, like entrances. Collapsible, Accordion, the overlay surfaces (Popover, Select, Menu, Tooltip), Drawer, Toast and InnerLoading used to close on --ease-emphasized-accelerate, which holds still for most of its duration and then snaps shut; closing on --ease-standard-decelerate starts at once and settles gently, so the same duration feels faster. The tokens themselves are unchanged.

  2. core 0.17.0

    bc6008b — Exits now use the decelerating curve, like entrances. Collapsible, Accordion, the overlay surfaces (Popover, Select, Menu, Tooltip), Drawer, Toast and InnerLoading used to close on --ease-emphasized-accelerate, which holds still for most of its duration and then snaps shut; closing on --ease-standard-decelerate starts at once and settles gently, so the same duration feels faster. The tokens themselves are unchanged.

  3. registry 0.22.0

    0ac645f — InnerLoading no longer sets aria-busy on its root while loading. The covered content is already inert, and aria-busy also held back the overlay's role="status" inside it, so screen readers could skip the status the overlay shows.

  4. registry 0.8.0

    b68c6ee — InnerLoading: InnerLoading, InnerLoadingContent and InnerLoadingOverlay, a loading overlay for one region. The content turns inert while loading, so nothing behind the scrim can be clicked, focused or read; the overlay mounts only while loading with a Spinner by default, and focus returns to the control that had it when loading ends.