---
package: "@svenskaspel/ui"
version: "4.4.0"
document_type: "component-documentation"
sources: ["@svenskaspel/ui/docs/loader.md","@svenskaspel/ui/docs/brand-cube-loader.md"]
canonical_url: "/components/loader"
usage_source: "src/app/(docs)/components/loader/page.mdx"
---
# Loader
***
## Usage
Loader provides feedback while work is in progress and the completion time is unknown. Start with the loading framework below to choose the right feedback for the task.

***
## Loading principles
### Invisible
Show ready content immediately. Keep useful content visible during refresh and use caching or preloading where appropriate. Avoid a loader that only flashes briefly, and never delay available content to complete an animation.
### Lightweight
Use the least intrusive feedback that explains the wait. Use Skeleton when the incoming layout is known, Loader when duration is unknown, and Button’s built-in Loading state for button actions. Keep feedback close to the affected area.
### Choreographed
Coordinate the indicator, status message and transition to the result as one sequence. Motion should explain change and create continuity. Around money and betting, keep feedback calm and factual; never imply success before it is confirmed.
Loading framework
| | |
| ------------------------- | ---------------------------------------- |
| Content already available | Show it immediately; no loader |
| Known incoming layout | Skeleton |
| Button action | Button’s built-in Loading state |
| Unknown completion time | Loader; Spinner by default |
| Measurable progress | Determinate progress |
| Longer wait | Explain the step, outcome, and recovery. |
***
## Loader variants and sizes
Use Spinner by default. Choose another variant only for an established context, not to imply a different waiting time. Select size by the affected region, not duration. Preserve intrinsic proportions; Dots has wider bounds.
Spinner is the default for general loading. Bars provides a processing metaphor when the remaining duration is unknown. Variant choice does not indicate measurable progress.
#### Spinner

XS: 16 × 16 px · S: 24 × 24 px
M: 32 × 32 px · L: 48 × 48 px
#### Bars

XS: 16 × 16 px · S: 24 × 24 px
M: 32 × 32 px · L: 48 × 48 px
Dots suits conversational or compact status feedback. Use the shared Button’s Loading state for button actions; its component owns the indicator.
#### Dots

XS: 28 × 6 px · S: 45 × 9 px
M: 60 × 12 px · L: 90 × 18 px
Loader size guide
| Size | Description |
| ------ | -------------------------------------------- |
| xsmall | Inline text, compact tables and labels |
| Small | Compact regions and input feedback |
| Medium | Cards, modals, content blocks |
| Large | Large regions; avoid blocking usable content |
***
## Brand Cube Loader
> Component relationship
>
> Brand Cube Loader is a separate component, not a variant of Loader. Use Loader for general loading feedback and Brand Cube Loader for branded loading moments connected to a product or business area. Both follow the shared loading and accessibility principles on this page.
### Branded loading
Use Cube to bring Svenska Spel’s identity into loading moments connected to a game, product or business area. It creates a recognisable link between the Svenska Spel winner symbol and the product cubes, reinforcing both the shared brand and the character of the experience.

Make the sequence relevant to what is loading. Connect the Svenska Spel winner symbol with the relevant product cubes to create a cohesive branded moment.
### Motion sequence
Connect the Svenska Spel winner with the relevant product cubes to create a cohesive branded loading experience.
Start with the Svenska Spel winner and rotate through the predefined product cubes. As each cube returns to face forward, switch to the next and gently slow down. Use smooth easing throughout.
After the last cube, return to the winner and loop while loading. Show ready content immediately; never wait for the loop to finish.
### Business area
For loading at business-area level, connect the Svenska Spel winner symbol with a relevant selection of product cubes. This creates a shared Svenska Spel expression while making the business area recognisable.
#### Tur

A shared loading expression for Tur and its products.
#### Sport / Casino

A shared loading expression for Sport / Casino and its products.
### Products
When a specific game or product loads, pair the Svenska Spel winner symbol with that product’s cube. Use the waiting moment to strengthen product recognition and its connection to Svenska Spel.
#### Product example Powerplay

Connect the Svenska Spel winner symbol with the Powerplay cube.
#### Product example Lotto

Connect the Svenska Spel winner symbol with the Lotto cube.
***
## Anatomy and behaviour (Loader and Brand Cube Loader)
### Anatomy
Loader and BrandCubeLoader include a built-in status region (role="status") and visually hidden text, defaulting to "Laddar". Use aria-label to customise the loading message for the task. Do not add a separate live region for the same loading message, as this may cause duplicate announcements.
### Timing and outcomes
Acknowledge actions promptly. If work finishes immediately, show the result without an intermediate loader. Keep variant, size and layout stable during the request. For longer waits, explain the current step without invented percentages. End loading on success, failure, timeout or cancellation and show the outcome. Offer retry or cancellation where supported.
***
## Placement and content
### Placement
Place Loader within or beside the affected region. Centre standalone indicators within their region; align inline indicators with their status text. Preserve useful content during background refresh and reserve space to avoid layout shifts.
### Responsive behaviour and content resilience
Keep the indicator at its published size and intrinsic proportions. Let status text wrap and its container grow. At narrow widths or with large text, stack the message below the indicator when needed. Test long Swedish text, zoom and Dots’ wider footprint. Never crop required feedback.
### Status text
Use aria-label to customise the loading message for the task, e.g. “Hämtar resultat” or “Sparar ändringar”. For a longer wait, explain the known step. Report completion clearly and give a useful next step on failure. For payments or submitted bets with an unknown outcome, confirm the transaction status before inviting another submission.

Example: Button with its built-in Loading state

Use the Button’s Loading state, not a separate Loader beside it. Keep the control and focus context stable, prevent repeat submission, and announce the outcome. The Button component owns its indicator and dimensions.
***
## Accessibility (Loader and Brand Cube Loader)
### Screen readers and ARIA
Use the built-in role="status" and customise its message with aria-label. Do not add another live region for the same loading message. Keep decorative animation hidden from assistive technology, not the status region. Preserve focus; do not make the indicator focusable. If using aria-busy, keep the announcing status outside the busy subtree. Announce completion or failure separately.
### Reduced motion
When prefers-reduced-motion is enabled, replace nonessential animation with a static indicator and status text, or text alone. Keep completion and failure feedback available. Verify the shared implementation’s support; do not assume it is built in.
### One loading announcement
Loader and BrandCubeLoader already include a built-in status region (role="status") and visually hidden text, defaulting to “Laddar”.
Customise the loading message using aria-label, e.g. “Hämtar resultat” or “Sparar ändringar”. Visible task text can still be helpful, especially for a longer wait, but announce the same message once. Verify with a screen reader that the customised message does not also announce the default “Laddar”.
#### Visible task context

> **Do:** Use aria-label to customise the loading message for the task. Do not add a separate live region for the same loading message, as this may cause duplicate announcements.
#### Unclear longer wait

> **Don't:** For longer waits, do not rely on animation alone. Add visible task context without a second live region. Announce completion and failure separately.
---
# Readme / API
# `Loader`
The `Loader` component is an indeterminate status indicator for work whose completion time is unknown.
## Importing
```tsx
import { Loader } from '@svenskaspel/ui/react/loader';
```
## Props
`Loader` accepts standard `span` attributes except `children`, plus:
| Prop | Type | Default | Description |
| ------------ | ------------------------------- | ----------- | ------------------------------------------------- |
| `variant` | `'bars' \| 'dots' \| 'spinner'` | `'spinner'` | Visual form of the indeterminate indicator. |
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Size of the indicator. |
| `aria-label` | `string` | `'Laddar'` | Accessible name announced by assistive software. |
| `className` | `string` | — | Additional classes applied to the status element. |
## Variants
- `bars` renders a three-bar wave that travels from left to right.
- `dots` renders four dots that each bounce by one dot height.
- `spinner` renders a primary circular stroke whose visible arc grows, contracts, and changes direction.
```tsx
```
## Sizes
- `xs` — 16px
- `sm` — 24px
- `md` — 32px (default)
- `lg` — 48px
The dots variant uses the same scale but is wider to contain four dots.
## Accessibility
The component renders a live status with visually hidden label text and a default value of `Laddar`. Supply a concise, localized `aria-label` when the surrounding context does not already describe what is loading. The animated shapes are hidden from assistive software, and animation is disabled when the user prefers reduced motion.
## Styling
All variants inherit their color from the semantic `text-primary` token. Pass a semantic text-color utility through `className` to override the color for a specific use case. Sizes use the theme spacing scale through the internal `--loader-size` variable, and motion uses the easing variables from the theme. Variant-specific geometry and timings remain component-scoped because they define the loader artwork rather than a reusable design token.
---
# `BrandCubeLoader`
The `BrandCubeLoader` alternates between the Svenska Spel fallback mark and supplied product brands while rotating continuously. Each incoming logo moves one face backward around the cube, keeping the brand change connected to the cube's physical rotation.
It is exported separately from `Loader`, so applications that only use lightweight loaders do not import `BrandCube`.
## Importing
```tsx
import { BrandCubeLoader } from '@svenskaspel/ui/react/brand-cube-loader';
import type { BrandCubeBrand } from '@svenskaspel/ui/react/brand-cube';
import KenoXpressTextonly from '@svenskaspel/ui/react/brands/KenoXpressTextonly';
import LottoTextonlyInverted from '@svenskaspel/ui/react/brands/LottoTextonlyInverted';
import StryktipsetTextonlyInverted from '@svenskaspel/ui/react/brands/StryktipsetTextonlyInverted';
import TrissTextonly from '@svenskaspel/ui/react/brands/TrissTextonly';
const brands = [
{ logotype: TrissTextonly, product: 'triss' },
{ logotype: StryktipsetTextonlyInverted, product: 'stryktipset' },
{ logotype: LottoTextonlyInverted, product: 'lotto' },
{ logotype: KenoXpressTextonly, product: 'kenoxpress' },
] satisfies readonly BrandCubeBrand[];
```
Import `svs.css` for the fallback cube and the theme CSS for every product in `brands`:
```css
@import '@svenskaspel/ui/tailwind/base.css';
@import '@svenskaspel/ui/tailwind/svs.css';
@import '@svenskaspel/ui/tailwind/triss.css';
@import '@svenskaspel/ui/tailwind/stryktipset.css';
@import '@svenskaspel/ui/tailwind/lotto.css';
@import '@svenskaspel/ui/tailwind/kenoxpress.css';
```
## Props
`BrandCubeLoader` accepts standard `span` attributes except `children`, plus:
| Prop | Type | Default | Description |
| ------------ | -------------------------------------- | ---------- | --------------------------------------------------- |
| `brands` | `readonly BrandCubeBrand[]` | `[]` | Product brands shown in sequence with the fallback. |
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | `BrandCube` size. |
| `aria-label` | `string` | `'Laddar'` | Accessible name announced by assistive software. |
| `className` | `string` | — | Additional classes applied to the status element. |
```tsx
```
Each descriptor pairs a `logotype` with its stable `product` identifier. Pass a single descriptor to alternate it with the fallback, or pass several to show each product in array order before returning to the fallback. With an empty `brands` array, the fallback mark continues rotating on its own.
The product core variables are not part of `base.css`. If a product's theme file is not imported, its `--{product}-core` value is unavailable and that cube becomes transparent.
## Animation
Every logo spans three consecutive faces. The fallback mark begins on face 1, and each incoming logo moves its starting point one face backward around the cube. The sequence repeats through faces `1 → 4 → 3 → 2`, while the three-face artwork follows each starting point.
Each `0.8s` segment rotates through `270deg`. The cube moves `9deg` beyond the flat outgoing face before the `250ms` cross-fade begins, then finishes the handoff at the edge shared with the incoming logo's starting face. Rotation uses the theme's cubic ease-out during that handoff, then cubic ease-in to accelerate through the remainder of the segment.
Animation is disabled when the user prefers reduced motion. In that mode, the static fallback mark remains visible.
Changing the products, logotypes, or order in `brands` restarts the sequence from the fallback intro so the old and new arrays cannot drift out of phase.
## Accessibility
The component renders a `status` with visually hidden label text and a default value of `Laddar`. Supply a more specific, localized `aria-label` when the surrounding context does not already describe what is loading. Cube artwork is hidden from assistive software.
## Styling
Brand backgrounds come from each descriptor's stable `--{product}-core` theme variable, so they do not change between light, dark, and vibrant themes. The loader-only shadow uses the semantic `--scrim` color token; its geometry is component-specific. Rotation and fading use the motion variables from the theme where a matching token exists.