lace:loading

Show, hide, or restyle elements while a component has a request in flight. For the full guide with live demos, see Loading States.

Syntax

<div lace:loading>Loading...</div>
<div lace:loading.hidden>Hide during load</div>
<div lace:loading.flex>Flex loader</div>
<div lace:loading.init>First load only</div>
<div lace:loading.proceeding>Subsequent loads</div>
<button lace:loading.class="opacity-50 cursor-wait">Button</button>

Modifiers

Modifier Behavior
(none) Show the element during any loading state.
.hidden Hide the element during loading.
.flex, .inline-flex, .block, ... Show with a specific CSS display value.
.init Show only during the initial component load.
.proceeding Show only during subsequent loads.
.class="..." Add CSS classes to the element while loading.

Scope a loader to a specific action with lace:target.

Example

<button lace:click="submit">
    <span lace:loading.hidden>Submit</span>
    <span lace:loading.flex class="items-center gap-2">
        <svg class="animate-spin h-4 w-4">...</svg>
        Loading...
    </span>
</button>

View this page as markdown - handy as context for your AI tools. Full index at /llms.txt.

Theme
Accent
Ink