Spinner Viur
<sl-spinner-viur> | SlSpinnerViur
Spinners are used to show the progress of an indeterminate operation.
<sl-spinner-viur></sl-spinner-viur>
import { SlSpinnerViur } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <SlSpinnerViur /> );
Examples
Size
Spinners are sized based on the current font size. To change their size, set the
font-size
property on the spinner itself or on a parent element as shown below.
<sl-spinner-viur></sl-spinner-viur> <sl-spinner-viur style="font-size: 2rem;"></sl-spinner-viur> <sl-spinner-viur style="font-size: 3rem;"></sl-spinner-viur>
import { SlSpinnerViur } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <> <SlSpinnerViur /> <SlSpinnerViur style={{ fontSize: '2rem' }} /> <SlSpinnerViur style={{ fontSize: '3rem' }} /> </> );
Color
The spinner’s colors can be changed by setting the --indicator-color
<sl-spinner-viur style="font-size: 3rem; --indicator-color: deeppink"></sl-spinner>
import { SlSpinnerViur } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <SlSpinnerViur style={{ fontSize: '3rem', '--indicator-color': 'deeppink' }} /> );
Speed
The spinner’s speed can be changed by setting the --speed
<sl-spinner-viur style="font-size: 2rem; --speed: .5s"></sl-spinner>
import { SlSpinnerViur } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <SlSpinnerViur style={{ fontSize: '2rem', '--speed': '.5s' }} /> );
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 from the CDN using a script tag:
<script type="module" src="https://cdn.jsdelivr.net/npm/@viur/shoelace@1.0.8-v2.18.0/cdn/components/spinner-viur/spinner-viur.js"></script>
To import this component from the CDN using a JavaScript import:
import 'https://cdn.jsdelivr.net/npm/@viur/shoelace@1.0.8-v2.18.0/cdn/components/spinner-viur/spinner-viur.js';
To import this component using a bundler:
import '@viur/shoelace/dist/components/spinner-viur/spinner-viur.js';
To import this component as a React component:
import SlSpinnerViur from '@viur/shoelace/dist/react/spinner-viur';
Custom Properties
Name | Description | Default |
---|---|---|
--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.