vael-ui v0.5.7

Feedback

Layout

Loader

A small spinner in five styles that sizes to the text around it. Use it to show that something is in progress.

Install

import { Loader } from 'vael-ui'

Playground

ConfigProvider's loader-type sets every loader in an app at once, the ones inside buttons, lists and toasts too.

Placement, behaviour and animation

Usage
<script setup lang="ts">
import { Loader } from 'vael-ui'
</script>

<template>
  <Loader size="1rem" />
</template>

Props

NameTypeDefaultDescription
sizestringAny CSS length. Sets the root's font-size, and the em-based ring scales with it.
labelstringRenders role="status" with visually hidden text as the accessible name. Omit it to make the loader aria-hidden.
typeLoaderSource'ring'The animation: 'ring', 'dots', 'bars', 'comet' or 'dither', or your own component in the same 1em box. Unset, it follows the nearest ConfigProvider's loaderType.
motionLoaderMotionHow it moves: its appearance ({ initial: { root: { opacity: 0, scale: 0.6 } } }). false holds it still, for a static busy mark.
uiPartial<Record<'root', UiPartValue>>Class and style overrides for each part.

Events

No events.

Slots

No slots.

Exposed

NameTypeDescription
elHTMLElement | nullRoot element.
partsRecord<string, HTMLElement | HTMLElement[] | null>Its elements by part name, for your own animation; a repeated part is an array.

Motion New

Loader: its appearance; false holds it still.

<Loader
  :motion="{ initial: { root: { opacity: 0, y: 4 } } }"
/>
NameTypeDescription
initialexitrootSets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate.
enterleave(parts, context) => animationAnimates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted.
springdurationeasing{ damping, response } | number | stringTimes all of it: a spring, or a duration in ms with an easing. Never both.
falsebooleanTurns its motion off, for an animation of your own on its exposed elements.

Accessibility

It has no keyboard interaction of its own.

  • Without label, it is aria-hidden, so pair it with visible text or a busy state on what it stands for.
  • With label, it renders role="status" named by visually hidden text, so screen readers announce it.
  • Under reduced motion, the built-in animations pulse instead of spinning.