Loader
Directive for applying Kikita UI loading indicator styling to an inline element.
Import the public directive from the published package entrypoint.
import { KuiLoaderDirective } from '@kikita-labs/ui';Apply kuiLoader to an inline element such as a span. The directive sets role="status" and aria-live="polite" so assistive technology announces the label.
<div class="loader-example">
<span kuiLoader label="Loading"></span>
</div>Use the shared Kikita size scale to match the loader to the surrounding control or text.
<div class="loader-size-example">
<span kuiLoader size="xs" label="Loading extra small"></span>
<span kuiLoader size="sm" label="Loading small"></span>
<span kuiLoader size="md" label="Loading medium"></span>
<span kuiLoader size="lg" label="Loading large"></span>
</div>kuiButton's own loading input (0.3.0) renders a kuiLoader internally, sets aria-busy="true", and behaves like disabled. Compose kuiLoader manually only when the button markup needs a custom saving label; otherwise prefer loading.
<div class="loader-button-example">
<button kuiButton type="button" disabled>
<span kuiLoader size="sm" label="Saving"></span>
Saving
</button>
<button kuiButton type="button" loading>Saving</button>
</div>Inputs verified against @kikita-labs/ui v1.6.1 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Loader size mapped to Kikita UI loader tokens. |
| label | string | 'Loading' | Accessible label rendered as aria-label. Also announced through the host role="status" and aria-live="polite". |
| --kui-loader-size | CSS custom property | - | Overrides the rendered loader diameter for the current size step. |
| --kui-loader-track | CSS custom property | - | Overrides the loader track (background ring) color. |
| --kui-loader-fill | CSS custom property | - | Overrides the loader spinning fill color. |
| --kui-loader-border-width | CSS custom property | - | Overrides the loader ring stroke width. |
| --kui-loader-duration | CSS custom property | - | Overrides the spin animation duration. |
Loader announces progress through a live region instead of relying on visual motion alone.
- The host element gets
role="status"andaria-live="polite"automatically; no extra ARIA wiring is required. labelsets the accessible name viaaria-labeland defaults toLoading. Provide a specific label (for exampleSaving) whenever the loading context is not obvious from surrounding text.- Since 0.3.0, the loader keeps
flex-shrink: 0so it no longer collapses into an oval when its flex container shrinks it, such as inside a wrapped multi-line button label. - When composed inside a
kuiButtonwith nativedisabled, the button itself communicates the busy state to assistive technology; keepdisabledset for the duration of the loading state.