On this page

chatty-block-survey

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

Copy page as MarkdownRead Markdown ↗

Key rules

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

Opt-in canonical survey adapter; submission and skipping bubble to the host. Class ChattyBlockSurvey.

Attributes

Name Property Type Default Description
block block object {} Canonical data with rating, comment, busy, submitted and error.

Properties

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

Not declared in the manifest.

Events

Name Detail type Description
chatty-submit CustomEvent<{rating: number, comment: string}> Host-owned rating save.
chatty-skip CustomEvent<{}> Host-owned survey dismissal.

Slots

Not declared in the manifest.

Parts

Not declared in the manifest.

CSS custom properties

Not declared in the manifest.

Usage

import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/chatty-block-survey.js';
<chatty-block-survey style="display:block;width:100%;max-width:360px"></chatty-block-survey>

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-block-survey.element.jsWrap code linesCopy
<chatty-block-survey style="display:block;width:100%;max-width:360px"></chatty-block-survey>
Standard
LightDarkDesktopMobile

Các variant hoặc state chính đặt cạnh nhau trong cùng ví dụ.

Show code
chatty-block-survey.element.jsWrap code linesCopy
import '@avada/chatty-ui/tokens/tokens.css';
import {html} from 'lit';
import '@avada/chatty-ui/elements/chatty-block-survey.js';
export function States() {
  return html`<div style="display:flex;flex-wrap:wrap;gap:20px;width:100%">
    <chatty-block-survey style="display:block;flex:1;min-width:220px" .block=${{data:{rating:4,busy:'submitting'}}}></chatty-block-survey>
    <chatty-block-survey style="display:block;flex:1;min-width:220px" .block=${{data:{rating:5,submitted:true}}}></chatty-block-survey>
  </div>`;
}

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-block-survey.element.jsWrap code linesCopy
<chatty-block-survey style="display:block;width:100%;max-width:360px"></chatty-block-survey>
Part Element Source
1 Element host chatty-block-survey chatty-ui/custom-elements.json

Keyboard

No element-specific keys.

Source

  • chatty-ui/custom-elements.json