On this page

chatty-skeleton

API chuẩn của element chatty-skeleton, sinh từ custom-elements.json của prototype trong guide.

Copy page as MarkdownRead Markdown ↗

Key rules

  • chatty-skeleton khai báo 2 attribute, 0 property không có attribute, 0 event, 0 slot, 1 part và 3 CSS custom property.
  • Import 1 module @avada/chatty-ui/elements/skeleton.js là define chatty-skeleton; 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

A placeholder bone with the final content's shape; hidden from assistive tech. The busy region around it (aria-busy, a status message) belongs to the caller. Class ChattySkeleton.

Attributes

Name Property Type Default Description
shape shape 'rect' | 'text' | 'circle' 'rect' rect block, 16px text line or 40px circle.
animation animation 'pulse' | 'none' 'pulse' pulse or none; reduced motion always stops the pulse.

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 Bone box.

CSS custom properties

Name Default Description
--chatty-skeleton-width – Bone width; full width by default.
--chatty-skeleton-height – Bone height; text and circle shapes have their own default.
--chatty-skeleton-color – Bone colour.

Usage

import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/skeleton.js';
<chatty-skeleton shape="circle"></chatty-skeleton>
<chatty-skeleton shape="text" style="flex-basis:100%;max-inline-size:240px"></chatty-skeleton>
<chatty-skeleton shape="text" style="flex-basis:100%;max-inline-size:144px"></chatty-skeleton>
<chatty-skeleton style="flex-basis:100%;max-inline-size:240px;--chatty-skeleton-height:96px"></chatty-skeleton>
<chatty-skeleton animation="none" style="flex-basis:100%;max-inline-size:240px;--chatty-skeleton-height:24px"></chatty-skeleton>

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ộ.

Standard
LightDarkDesktopMobile

Default: trạng thái mặc định và nội dung mẫu của element.

Show code
chatty-skeleton.element.jsWrap code linesCopy
<chatty-skeleton shape="circle"></chatty-skeleton>
<chatty-skeleton shape="text" style="flex-basis:100%;max-inline-size:240px"></chatty-skeleton>
<chatty-skeleton shape="text" style="flex-basis:100%;max-inline-size:144px"></chatty-skeleton>
<chatty-skeleton style="flex-basis:100%;max-inline-size:240px;--chatty-skeleton-height:96px"></chatty-skeleton>
<chatty-skeleton animation="none" style="flex-basis:100%;max-inline-size:240px;--chatty-skeleton-height:24px"></chatty-skeleton>

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ả.

Standard
LightDarkDesktopMobile

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-skeleton.element.jsWrap code linesCopy
<chatty-skeleton shape="circle"></chatty-skeleton>
<chatty-skeleton shape="text" style="flex-basis:100%;max-inline-size:240px"></chatty-skeleton>
<chatty-skeleton shape="text" style="flex-basis:100%;max-inline-size:144px"></chatty-skeleton>
<chatty-skeleton style="flex-basis:100%;max-inline-size:240px;--chatty-skeleton-height:96px"></chatty-skeleton>
<chatty-skeleton animation="none" style="flex-basis:100%;max-inline-size:240px;--chatty-skeleton-height:24px"></chatty-skeleton>
Part Element Source
1 CSS part base chatty-ui/custom-elements.json

Keyboard

No element-specific keys.

Source

  • chatty-ui/custom-elements.json