UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

58 lines (37 loc) 1.51 kB
# 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. | | `ref` | `any` | | | A ref to apply to the root element. | | `size` | `'large' \| 'medium' \| 'small'` | | `small` | | ## Accessibility ## Implementation guidelines 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. ## 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="n-flex n-gap-token-16"> <LoadingSpinner size="small" /> <LoadingSpinner size="medium" /> <LoadingSpinner size="large" /> </div> ); }; export default Component; ```