Spinner
<mo-spinner> | MOSpinner
Spinners are used to indicate that an action is taking place.
<mo-spinner></mo-spinner>
import { MOSpinner } from '@metsooutotec/modes-web-components/dist/react'; const App = () => <MOSpinner />;
Examples
Size
Spinners are sized based on the current font size. The default value is 48px. To change their size, set the
font-size
property on the spinner itself or on a parent element as shown below.
<mo-spinner></mo-spinner> <mo-spinner style="font-size: 2rem;"></mo-spinner> <mo-spinner style="font-size: 1rem;"></mo-spinner>
import { MOSpinner } from '@metsooutotec/modes-web-components/dist/react'; const App = () => ( <> <MOSpinner /> <MOSpinner style={{ fontSize: '2rem' }} /> <MOSpinner style={{ fontSize: '3rem' }} /> </> );
Track width
The width of the spinner’s track can be changed by setting the --track-width
custom property.
<mo-spinner style="font-size: 50px; --track-width: 10px;"></mo-spinner>
import { MOSpinner } from '@metsooutotec/modes-web-components/dist/react'; const App = () => ( <MOSpinner style={{ fontSize: '3rem', '--track-width': '6px' }} /> );
Color
The spinner’s colors can be changed by setting the --indicator-color
and
--track-color
custom properties.
<mo-spinner style="font-size: 3rem; --indicator-color: var(--mo-color-highlight-2-darker); --track-color: var(--mo-color-highlight-2-lighter);" ></mo-spinner>
import { MOSpinner } from '@metsooutotec/modes-web-components/dist/react'; const App = () => ( <MOSpinner style={{ fontSize: '3rem', '--indicator-color': 'var(--mo-color-highlight-2-darker)', '--track-color': 'var(--mo-color-highlight-2-lighter)' }} /> );
Importing
If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.
To import this component using a bundler:
import '@metsooutotec/modes-web-components/dist/components/spinner/spinner.js';
To import this component as a React component:
import MOSpinner from '@metsooutotec/modes-web-components/dist/react/spinner/';
To import this component using a script tag:
<script type="module" src="https://modes-web.metso.com/dist/components/cdn/components/spinner/spinner.js"></script>
Custom Properties
Name | Description | Default |
---|---|---|
--track-width |
The width of the track. | |
--track-color |
The color of the track. | |
--indicator-color |
The color of the indicator. | |
--speed |
The time it takes for the spinner to complete one animation cycle. |
Learn more about customizing CSS custom properties.
Parts
Name | Description |
---|---|
base |
The component’s internal wrapper. |
Learn more about customizing CSS parts.