Key rules
chatty-spinnerkhai báo 2 attribute, 0 property không có attribute, 0 event, 0 slot, 1 part và 2 CSS custom property.- Import 1 module
@avada/chatty-ui/elements/spinner.jslà definechatty-spinner; chunk chỉ import element nó dùng. Prototype chuẩn: trong guide. - Đổi tên attribute, event, slot, part hay CSS custom property là đổi API: diff của custom-elements.json phải có trong 1 MR.
On this page
Overview
An indeterminate loading ring; decorative unless it has a label. Class ChattySpinner.
Attributes
| Name | Property | Type | Default | Description |
|---|---|---|---|---|
size |
size |
'sm' | 'md' | 'lg' |
'md' |
Ring size: 16, 24 or 32px. |
label |
label |
string |
'' |
Accessible name; set it to expose role progressbar, empty keeps it decorative. |
Properties
Attributes also expose the properties listed in the Property column above.
Not declared in the manifest.
Events
Not declared in the manifest.
Slots
Not declared in the manifest.
Parts
| Name | Description |
|---|---|
base |
Ring box. |
CSS custom properties
| Name | Default | Description |
|---|---|---|
- |
– | Ring width and height; overrides size. |
- |
– | Ring colour; defaults to the accent. |
Usage
import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/spinner.js';
<chatty-spinner size="sm"></chatty-spinner>
<chatty-spinner></chatty-spinner>
<chatty-spinner size="lg" label="Loading orders"></chatty-spinner>
Live preview
Component thật dùng cùng story với trang component; dữ liệu mẫu nằm trong frame cục bộ.
Default: trạng thái mặc định và nội dung mẫu của element.
Show code
<chatty-spinner size="sm"></chatty-spinner>
<chatty-spinner></chatty-spinner>
<chatty-spinner size="lg" label="Loading orders"></chatty-spinner>Anatomy
Số trong hình khớp bảng bên dưới. Phần chỉ hiện ở state khác được ghi Not shown; ví dụ không thêm phần tử giả.
Anatomy: một instance mặc định riêng, có khoảng trống quanh các phần được đánh số.
Show code
<chatty-spinner size="sm"></chatty-spinner>
<chatty-spinner></chatty-spinner>
<chatty-spinner size="lg" label="Loading orders"></chatty-spinner>| Part | Element | Source |
|---|---|---|
| 1 | CSS part base |
chatty- |
Keyboard
No element-specific keys.
Source
- chatty-ui/custom-elements.json