Spinner & Loading
Category: DataSPIN is a static buffer, indicating that data or resources are being loaded, prompting the user to wait; this buffer supports multi-subject colors and dark mode inversion.

Implementation Methods for Spinners
There are currently three ways to implement spinners:
- Directly use the
oc-spincustom tag, which is essentially a:beforepseudo-element; - Use
--_spinand--_spin-dkCSS variables as background images (e.g.,background:var(--_spin)), which are essentially SVG images; - For elements populated via AJAX, you can additionally use the
._spin-block,._spin-flex, or._spin-inlinestyle classes, which are also:beforepseudo-elements;
- Output
- HTML
-
Loading... Loading... Loading... Loading... Loading... -
Inverted (Dark Mode)
For dark backgrounds, there are three corresponding inverted spinner variants:
- Use the
oc-spincustom tag with theinvertedattribute; - Use the
--_spin-dkCSS variable as background image; - Use the
._spin-block-dk,._spin-flex-dk, or._spin-inline-dkstyle classes;
- Output
- HTML
Usage Recommendations
The three spinner implementations have different structures and styles to accommodate various usage scenarios:
- If the parent element has permission to insert content, you can directly insert the
oc-spincustom tag; - If the parent element doesn't have permission to insert content, you can add style classes;
- If users need custom modules and write their own CSS, they can directly use the spinner variables;
Basic Usage
The custom tag oc-spin represents a loading spinner with a default size of 32px, which can be modified as needed.
- Output
- HTML
Color Themes
Modify the spinner's color theme using the theme attribute. Available theme colors include: prim (default), error, succ, info, warn, issue, text, brief, and caption.
- Output
- HTML
Sizes
Set the size using the size attribute:
- sm: Small size (14px)
- md: Medium size (32px, default)
- lg: Large size (56px)
- Output
- HTML
Custom Sizing
You can directly modify the width style to change its size, or modify its own --_spin-sz variable.
- Output
- HTML
Usage in Custom Buttons
Spinners can be freely used within oc-btn tags.
Usage in Native Buttons
Spinners can be inserted into any node as regular HTML, including native button elements.
Attributes
| Name | Possible Values | Default | Description |
|---|---|---|---|
| size | 'sm'/'md'/'lg' | 'md' | Size (sm=14px, md=32px, lg=40px) |
| theme | 'prim'/'error'/'succ'/'info'/'warn'/'issue'/'text'/'brief'/'caption' | 'prim' | Color theme (defaults to primary) |
| inverted | - | - | Color inversion for dark backgrounds |
