Skip to content

← All components

Display and feedback

Spinner

Compact live loading indicator with an accessible label.

Live example

Loading small previewLoading previewLoading large preview

Usage

Each example includes the complete adapter-specific parameter reference. Copy it as a starting point, then remove options your use case does not need.

React

tsx
import { Spinner } from "@cofob/design-system-react";

/**
 * Complete Spinner parameter reference.
 * @param label
 *   type: string | renderable content
 *   default: "Loading"
 *   example: "Accessible label"
 * @param size
 *   type: "sm" | "md" | "lg" (plus heading sizes)
 *   default: "md"
 *   example: "md"
 * @param span attributes
 *   type: native element attributes
 *   default: —
 *   example: class / style / aria-* / data-*
 */
export function SpinnerExample() {
  return (
    <Spinner label="Loading results" />
  );
}

Svelte

svelte
<script lang="ts">
  import { Spinner } from "@cofob/design-system-svelte";

  // Complete Spinner parameter reference.
  // label
  //   type: string | renderable content
  //   default: "Loading"
  //   example: "Accessible label"
  // size
  //   type: "sm" | "md" | "lg" (plus heading sizes)
  //   default: "md"
  //   example: "md"
  // span attributes
  //   type: native element attributes
  //   default: —
  //   example: class / style / aria-* / data-*
</script>

<Spinner label="Loading results" />

HTML

html
<!--
  Complete Spinner parameter reference.
  label
    type: string | renderable content
    default: "Loading"
    example: "Accessible label"
  size
    type: "sm" | "md" | "lg" (plus heading sizes)
    default: "md"
    example: "md"
  span attributes
    type: native element attributes
    default: —
    example: class / style / aria-* / data-*
-->
<span class="cf-spinner" role="status"><span class="cf-visually-hidden">Loading</span></span>

Parameters

Adapter differences are explicit. Native element attributes are forwarded in React and Svelte and can be written directly in HTML.

ParameterTypeDefaultAdaptersExampleDescription
labelstring | renderable content"Loading"React · Svelte · HTML"Accessible label"Visible or accessible name, depending on the component.
size"sm" | "md" | "lg" (plus heading sizes)"md"React · Svelte · HTML"md"Applies a design-system size token.
span attributesnative element attributesReact · Svelte · HTMLclass / style / aria-* / data-*Forwards native class/style, accessibility, event, and data attributes to the root element.