Loader
Directive for applying Kikita UI loading indicator styling to an inline element.
Import the public directive from the published package entrypoint.
import { KuiLoader } 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. A loading button keeps full opacity, and a kuiLoader inside a button takes the button text colour.
<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>Set defaults.loader once for the application or for a subtree. Each option resolves as local input > defaults.loader.<option> > built-in default.
import { provideKikitaUi } from '@kikita-labs/ui';
export const appConfig: ApplicationConfig = {
providers: [
provideKikitaUi({
defaults: {
loader: {
/* options below */
},
},
}),
],
};| Name | Type | Default | Description |
|---|---|---|---|
| size | 'xs' | 'sm' | 'md' | 'lg' | — | Component size. Takes precedence over the global defaults.size. |
Every text the component owns (accessible names, visible words, announcements) is a typed message with an English default. Override it for the application with provideKikitaUi({ messages }), or for a subtree with provideKuiMessages.
| Name | Type | Default | Description |
|---|---|---|---|
| clear | string | — | Accessible name of a clear action. Default Clear. |
| close | string | — | Accessible name of a close action. Default Close. |
| loading | string | — | Accessible name of a busy indicator. Default Loading. |
| remove | string | — | Accessible name of a remove action. Default Remove. |
Inputs verified against @kikita-labs/ui v2.0.0 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| size | 'xs' | 'sm' | 'md' | 'lg' | undefined | undefined | Loader size. Falls back to defaults.loader.size, then the global defaults.size, then md. |
| label | string | undefined | undefined | Accessible label rendered as aria-label and announced through the host role="status" and aria-live="polite". Falls back to the common.loading message (Loading). |
| --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. |
| --kui-loader-duration-reduced | CSS custom property | - | Spin animation duration used when the user prefers reduced motion. |
| KuiLoaderOptions | interface | - | Shape of defaults.loader: size. |
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 to thecommon.loadingmessage (Loading), so it follows the active locale. 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.
Consumer-visible changes of @kikita-labs/ui 2.0 for Loader.
- The directive class is
KuiLoader; theDirectivesuffix is gone. - The default size moved to
provideKuiDefaults({ loader: { size } }). - The default
labelnow comes from thecommon.loadingmessage, so it followsprovideKuiLocaleandprovideKuiMessages; an unsetlabelisundefined. --kui-loader-duration-reducedsets the spin duration under reduced motion.- A loading Button keeps full opacity, and a
kuiLoaderplaced inside a Button takes the button text colour.