[//]: # (This file is auto-generated by the docs:generate-skills script, do not edit it manually)

# LoadingSpinner

Import: `import { LoadingSpinner } from '@neo4j-ndl/react'`

## Props

### LoadingSpinner

| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `as` | `ElementType<any, keyof IntrinsicElements>` |  |  | An override of the default HTML tag of the root of the component. Can also be another React component. |
| `loadingMessage` | `string` |  | `Loading content` | The aria label for the loading spinner. If not provided, defaults to "Loading content". |
| `ref` | `any` |  |  | A ref to apply to the root element. |
| `size` | `'large' \| 'medium' \| 'small'` |  | `small` | The size of the loading spinner. |

## Accessibility

## Implementation guidelines

`LoadingSpinner` renders an element with `role="status"` and an accessible name.

- The accessible name defaults to "Loading content". Use `loadingMessage` to say what is loading, for example "Loading dashboard".
- The spinner is a visual indicator without text content, so screen readers may not announce it when it appears. Announce the loading state yourself, for example by updating a persistent `role="status"` element in your application.

### Related WCAG criteria

- [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html) (A): The spinner has an accessible name that can be customized
- [4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) (A): The spinner exposes the `status` role with a name
- [4.1.3 Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) (AA): The application is responsible for announcing the loading state, see above

## Examples

### Default

```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';

import { LoadingSpinner } from '@neo4j-ndl/react';

const Component = () => {
  return <LoadingSpinner />;
};

export default Component;
```

### Sizes

```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';

import { LoadingSpinner } from '@neo4j-ndl/react';

const Component = () => {
  return (
    <div className="flex gap-token-16">
      <LoadingSpinner size="small" />

      <LoadingSpinner size="medium" />

      <LoadingSpinner size="large" />
    </div>
  );
};

export default Component;
```
