Spinner Ready
Spinners are used to indicate users that their action is being processed. Duet’s spinner is built entirely with HTML and CSS, and doesn’t rely on JavaScript.
You can customize the size and color of the spinner with the provided properties. Spinner comes in three sizes: small, medium and large.
Examples #
<duet-spinner size="small" theme="default"></duet-spinner>
<duet-spinner size="medium" theme="default"></duet-spinner>
<duet-spinner size="large" theme="default"></duet-spinner>
<duet-spinner size="large" color="currentColor"></duet-spinner>
<duet-spinner size="large" color="success"></duet-spinner>
Properties #
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
accessibleLabel | accessible-label | Adds accessible label for the spinner that is only shown for screen readers. | string | undefined |
color | color | Color of the spinner, as a design token entered in camelCase or kebab-case. Example: "color-primary". This property can also be set to "currentColor" which forces the icon to use the CSS text color of parent element instead. Useful when you want to control the color in stylesheet instead. | string | "gray-lightest" |
size | size | Size variation of the spinner. | "large" | "medium" | "small" | "small" |
theme | theme | Theme of the spinner. When used this will override the color setting and use "primary" or "primary-turva" as the color depending on which theme is chosen. | "" | "default" | "turva" | "" |
Usage #
This section includes guidelines for designers and developers about the usage of this component in different contexts.
When to use #
- To indicate users that their action is being processed.
- For loading states.
When not to use #
- For showing progress. Favor a progress bar instead.
Accessibility #
This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.
- Spinner is a custom element with animated loading indicator inside.
- To communicate loading state for a user, use aria-live attributes and appropriate content.
accessibleLabel
property can be used to add aria-label for the spinner that is only shown for screen readers.
Integration
For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.
Tutorials
Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:
Building Layouts
TutorialsUsing CLI Tools
TutorialsCreating Custom Patterns
TutorialsServer Side Rendering
TutorialsSharing Prototypes
TutorialsUsage With Markdown
Troubleshooting
If you experience any issues while using a component, please head over to the Support page for more guidelines and help.