@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
58 lines (37 loc) • 1.51 kB
Markdown
Import: `import { LoadingSpinner } from '@neo4j-ndl/react'`
| 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. |
| `ref` | `any` | | | A ref to apply to the root element. |
| `size` | `'large' \| 'medium' \| 'small'` | | `small` | |
The loading spinner component uses `role='status'` and `aria-label='Loading content'` to notify assistive technologies that a background process is occurring. The `aria-live='polite'` setting ensures screen readers announce the message non-intrusively when the spinner appears or updates. This informs users that content is loading without interrupting their workflow.
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { LoadingSpinner } from '@neo4j-ndl/react';
const Component = () => {
return <LoadingSpinner />;
};
export default Component;
```
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { LoadingSpinner } from '@neo4j-ndl/react';
const Component = () => {
return (
<div className="n-flex n-gap-token-16">
<LoadingSpinner size="small" />
<LoadingSpinner size="medium" />
<LoadingSpinner size="large" />
</div>
);
};
export default Component;
```