Key rules
chatty-pre-chatkhai báo 5 attribute, 0 property không có attribute, 3 event, 0 slot, 1 part và 0 CSS custom property.- Import 1 module
@avada/chatty-ui/elements/pre-chat.jslà definechatty-pre-chat; 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
Contact invitation or saved-email receipt under the original reply. Class ChattyPreChat.
Attributes
| Name | Property | Type | Default | Description |
|---|---|---|---|---|
email |
email |
string |
'' |
Saved email; a receipt replaces the invitation when present. |
label |
label |
string |
'Get replies by email' |
Translated invitation. |
skip- |
skipLabel |
string |
'Chat anonymously' |
Translated anonymous option. |
confirmation |
confirmation |
string |
'Replies will also go to { |
Translated receipt template; {{email}} marks the saved email. |
skippable |
skippable |
boolean |
false |
Shows the anonymous option. |
Properties
Attributes also expose the properties listed in the Property column above.
Not declared in the manifest.
Events
| Name | Detail type | Description |
|---|---|---|
chatty- |
CustomEvent<{ |
Opens contact collection. |
chatty- |
CustomEvent<{ |
Requests anonymous chat. |
click |
MouseEvent |
Native invitation button click. |
Slots
Not declared in the manifest.
Parts
| Name | Description |
|---|---|
base |
Contact invitation. |
CSS custom properties
Not declared in the manifest.
Usage
import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/pre-chat.js';
<chatty-pre-chat skippable></chatty-pre-chat>
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-pre-chat skippable></chatty-pre-chat> Các variant hoặc state chính đặt cạnh nhau trong cùng ví dụ.
Show code
<chatty-pre-chat email="customer@example.com"></chatty-pre-chat>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-pre-chat skippable></chatty-pre-chat> | Part | Element | Source |
|---|---|---|
| 1 | CSS part base |
chatty- |
Keyboard
| Key | Action |
|---|---|
| Enter / Space | Activate the invitation or anonymous- |
Source
- chatty-ui/custom-elements.json