On this page

chatty-answer-error

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

Copy page as MarkdownRead Markdown ↗

Key rules

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

Customer-safe answer error with a host-owned retry action. Class ChattyAnswerError.

Attributes

Name Property Type Default Description
label label string 'Something went wrong while preparing the answer.' Translated safe error message.
retry-label retryLabel string 'Try again' Translated retry action.
disabled disabled boolean false Disables retry independently of pending progress.

Properties

Attributes also expose the properties listed in the Property column above.

Name Type Default Description
loading boolean false Pending retry keeps the same focusable button while blocking repeated activation.

Events

Name Detail type Description
chatty-retry CustomEvent<{}> Requests another answer attempt.
click MouseEvent Native retry button click.

Slots

Not declared in the manifest.

Parts

Name Description
base Error alert.
retry Retry button.

CSS custom properties

Not declared in the manifest.

Usage

import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/answer-error.js';
<chatty-answer-error></chatty-answer-error> 

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-answer-error.element.jsWrap code linesCopy
<chatty-answer-error></chatty-answer-error> 

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-answer-error.element.jsWrap code linesCopy
<chatty-answer-error></chatty-answer-error> 
Part Element Source
1 CSS part base chatty-ui/custom-elements.json
2 CSS part retry chatty-ui/custom-elements.json

Keyboard

Key Action
Enter / Space Activate retry when available.

Source

  • chatty-ui/custom-elements.json