On this page Key rules Use when / Avoid Live preview Standard AI Mode Classic Admin Do / Don't Accessibility Target Components
Cart notice Thông báo kết quả giỏ hàng khi không có dòng giá hoặc số lượng hợp lệ.
Copy page as Markdown Read Markdown ↗
Key rules
Dùng kết quả từ caller; success có thể mở giỏ, failure hiển thị lý do.
Element chatty-cart-notice ở mục Standard là chuẩn chatty-ui port theo; các mục theo surface mô tả component React đang chạy.
On this page Key rules Use when / Avoid Use instead Live preview Standard Element API AI Mode Import / element Anatomy Placement / order Props Sizes Tokens States Behaviour Copy Source Classic Import / element Anatomy Placement / order Props Sizes Tokens States Behaviour Copy Source Admin Import / element Anatomy Placement / order Props Sizes Tokens States Behaviour Copy Source Do / Don't Accessibility Target Use when / Avoid
Dùng khi kết quả giỏ không đủ dữ liệu để dựng receipt chi tiết.
Use instead
Component
Use when
CartNotice
Kết quả thêm giỏ thành công hoặc thất bại.
CartConfirmation
Receipt có dòng giỏ chi tiết.
Live preview
Standard
Surface AI Mode Classic Light Dark Desktop Mobile
Một receipt cho năm dòng thêm cùng lượt; storefront hiện ba dòng và summary.
Show code chatty-cart-confirmation.element.js Wrap code lines Copy <chatty-cart-confirmation grouped heading="Added 5 products to cart">
<chatty-cart-confirmation slot="items" quantity="2" price="$48.00"
><img slot="media" src="/fixtures/tote.svg" alt="" />Canvas tote bag<span slot="detail"
>Natural / Large</span
></chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$18.00"
>Ceramic mug</chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$28.00"
><img slot="media" src="/fixtures/cap.svg" alt="" />Wool cap</chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$24.00"
>Linen scarf</chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$18.00"
>Leather wallet</chatty-cart-confirmation
>
<span slot="more">and 2 more products — view in cart</span>
<chatty-button slot="action" variant="plain">View cart</chatty-button>
</chatty-cart-confirmation>
Standard
Grouped receipt: đặt grouped trên receipt cha, heading đã dịch, các receipt con trong slot items, summary đã dịch trong slot more và một action ở receipt cha. Trên storefront, hơn bốn dòng thì hiện ba dòng; show-all dành cho Admin history; Admin không có action View cart vì merchant không mở giỏ của shopper. API sinh ở chatty-cart-confirmation .
Standard
Surface AI Mode Classic admin inbox Light Dark Desktop Mobile
Element chatty-cart-notice: đã thêm có View cart, và không thêm được có lý do.
Show code chatty-cart-notice.element.js Wrap code lines Copy import '@avada/chatty-ui/tokens/tokens.css';
import {IconAlertCircle, IconCheck} from '@avada/chatty-ui/elements/icon-glyphs.js';
// Standard: the chatty-cart-notice prototype chatty-ui ports from (chatty-ui/src/elements/cart-notice.js).
import {html} from 'lit';
import '@avada/chatty-ui/elements/cart-notice.js';
import '@avada/chatty-ui/elements/button.js';
export function Standard() {
return html`
<chatty-cart-notice>
${IconCheck({slot: 'icon'})} Cotton shirt
<chatty-button slot="action" variant="plain">View cart</chatty-button>
</chatty-cart-notice>
<chatty-cart-notice tone="critical">
${IconAlertCircle({slot: 'icon'})} Cotton shirt
<span slot="detail">Sold out</span>
</chatty-cart-notice>
`;
}
Prototype (cùng cart-notice.styles.js) là chuẩn: chatty-ui port 1:1, và chatty-ui/custom-elements.json sinh từ chính prototype. Icon, tên sản phẩm, lý do và nút View cart đi vào qua slot; vùng thông báo đặt tên bằng tiêu đề cộng tên sản phẩm. Chưa surface nào dùng element thật; các mục bên dưới mô tả React đang chạy.
Element
Element
Module
chatty-cart-notice
@avada/chatty-ui/elements/cart-notice.js
API
AI Mode
Standard
Surface AI Mode Light Dark Desktop Mobile
Element chatty-cart-notice: đã thêm có View cart, và không thêm được có lý do.
Show code chatty-cart-notice.element.js Wrap code lines Copy import '@avada/chatty-ui/tokens/tokens.css';
import {IconAlertCircle, IconCheck} from '@avada/chatty-ui/elements/icon-glyphs.js';
// Standard: the chatty-cart-notice prototype chatty-ui ports from (chatty-ui/src/elements/cart-notice.js).
import {html} from 'lit';
import '@avada/chatty-ui/elements/cart-notice.js';
import '@avada/chatty-ui/elements/button.js';
export function Standard() {
return html`
<chatty-cart-notice>
${IconCheck({slot: 'icon'})} Cotton shirt
<chatty-button slot="action" variant="plain">View cart</chatty-button>
</chatty-cart-notice>
<chatty-cart-notice tone="critical">
${IconAlertCircle({slot: 'icon'})} Cotton shirt
<span slot="detail">Sold out</span>
</chatty-cart-notice>
`;
}
Current (React), being replaced
Surface AI Mode Light Dark Desktop Mobile
Kết quả thêm giỏ và lỗi với dữ liệu cục bộ.
Show code cart-notice.jsx Wrap code lines Copy import React from 'react';
import {CartNotice} from '@avada/chatty-ui/primitives/CartNotice.jsx';
export function Catalogue({surface}) {
return <div>
<CartNotice notice={{kind: 'added', title: 'Cotton shirt'}} translate={text => text} onViewCart={surface === 'admin' ? undefined : () => {}} />
<CartNotice notice={{kind: 'failure', title: 'Cotton shirt', reason: 'Sold out'}} translate={text => text} />
</div>;
}
Import / element
Component / element
Import / file
Scope root
CartNotice
@avada/chatty-ui/primitives/CartNotice.jsx
.chatty-ai-mode
Anatomy
Part
Element
1
Section chứa icon, nhãn và nội dung.
2
Nút View cart tùy chọn ở kết quả thành công.
Placement / order
Context
Order
Notice
Icon trước body; nhãn, title, reason rồi action.
Props
Sizes
Tokens
Part
Token
Light
Dark
Text
--chatty-color-text
Fallback #303030
Theo scope
Failure
--chatty-color-critical
Fallback #c5280 c
Theo scope
States
State
Trigger
Visual change (values)
ARIA/attribute
Success
kind added
Icon check, có thể hiện View cart.
Native button
Failure
kind failure
Icon alert, nhãn lỗi và reason nếu có.
Không thêm role
Behaviour
Interaction
Result
View cart
Gọi handler từ caller.
Invalid notice
Trả null.
Copy
String
i18n key
Where
Added to cart
Added to cart
Nhãn success
Could not add to cart
Could not add to cart
Nhãn failure
View cart
View cart
Action success
Source
File
Evidence
API và markup
Style
Classic
Standard
Surface Classic Light Dark Desktop Mobile
Element chatty-cart-notice: đã thêm có View cart, và không thêm được có lý do.
Show code chatty-cart-notice.element.js Wrap code lines Copy import '@avada/chatty-ui/tokens/tokens.css';
import {IconAlertCircle, IconCheck} from '@avada/chatty-ui/elements/icon-glyphs.js';
// Standard: the chatty-cart-notice prototype chatty-ui ports from (chatty-ui/src/elements/cart-notice.js).
import {html} from 'lit';
import '@avada/chatty-ui/elements/cart-notice.js';
import '@avada/chatty-ui/elements/button.js';
export function Standard() {
return html`
<chatty-cart-notice>
${IconCheck({slot: 'icon'})} Cotton shirt
<chatty-button slot="action" variant="plain">View cart</chatty-button>
</chatty-cart-notice>
<chatty-cart-notice tone="critical">
${IconAlertCircle({slot: 'icon'})} Cotton shirt
<span slot="detail">Sold out</span>
</chatty-cart-notice>
`;
}
Current (React), being replaced
Surface Classic Light Dark Desktop Mobile
Kết quả trong widget Classic.
Show code cart-notice.jsx Wrap code lines Copy import React from 'react';
import {CartNotice} from '@avada/chatty-ui/primitives/CartNotice.jsx';
export function Catalogue({surface}) {
return <div>
<CartNotice notice={{kind: 'added', title: 'Cotton shirt'}} translate={text => text} onViewCart={surface === 'admin' ? undefined : () => {}} />
<CartNotice notice={{kind: 'failure', title: 'Cotton shirt', reason: 'Sold out'}} translate={text => text} />
</div>;
}
Import / element
Component / element
Import / file
Scope root
CartNotice
@avada/chatty-ui/primitives/CartNotice.jsx
.Avada-Faqs_Popup
Anatomy
Part
Element
1
Section chứa icon, nhãn và nội dung.
2
Nút View cart tùy chọn ở kết quả thành công.
Placement / order
Context
Order
Notice
Icon trước body; nhãn, title, reason rồi action.
Props
Sizes
Tokens
Part
Token
Light
Dark
Text
--chatty-color-text
Fallback #303030
Theo scope
Failure
--chatty-color-critical
Fallback #c5280 c
Theo scope
States
State
Trigger
Visual change (values)
ARIA/attribute
Success
kind added
Icon check, có thể hiện View cart.
Native button
Failure
kind failure
Icon alert, nhãn lỗi và reason nếu có.
Không thêm role
Behaviour
Interaction
Result
View cart
Gọi handler từ caller.
Invalid notice
Trả null.
Copy
String
i18n key
Where
Added to cart
Added to cart
Nhãn success
Could not add to cart
Could not add to cart
Nhãn failure
View cart
View cart
Action success
Source
File
Evidence
API và markup
Style
Admin
Standard
Surface admin inbox Light Dark Desktop Mobile
Admin history dùng show-all để hiện hết năm dòng; không có action View cart.
Show code chatty-cart-confirmation.element.js Wrap code lines Copy <chatty-cart-confirmation grouped show-all heading="Added 5 products to cart">
<chatty-cart-confirmation slot="items" quantity="2" price="$48.00"
><img slot="media" src="/fixtures/tote.svg" alt="" />Canvas tote bag<span slot="detail"
>Natural / Large</span
></chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$18.00"
>Ceramic mug</chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$28.00"
><img slot="media" src="/fixtures/cap.svg" alt="" />Wool cap</chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$24.00"
>Linen scarf</chatty-cart-confirmation
>
<chatty-cart-confirmation slot="items" quantity="1" price="$18.00"
>Leather wallet</chatty-cart-confirmation
>
<span slot="more">and 2 more products — view in cart</span>
</chatty-cart-confirmation>
Standard
Surface admin inbox Light Dark Desktop Mobile
Element chatty-cart-notice: đã thêm có View cart, và không thêm được có lý do.
Show code chatty-cart-notice.element.js Wrap code lines Copy import '@avada/chatty-ui/tokens/tokens.css';
import {IconAlertCircle, IconCheck} from '@avada/chatty-ui/elements/icon-glyphs.js';
// Standard: the chatty-cart-notice prototype chatty-ui ports from (chatty-ui/src/elements/cart-notice.js).
import {html} from 'lit';
import '@avada/chatty-ui/elements/cart-notice.js';
import '@avada/chatty-ui/elements/button.js';
export function Standard() {
return html`
<chatty-cart-notice>
${IconCheck({slot: 'icon'})} Cotton shirt
<chatty-button slot="action" variant="plain">View cart</chatty-button>
</chatty-cart-notice>
<chatty-cart-notice tone="critical">
${IconAlertCircle({slot: 'icon'})} Cotton shirt
<span slot="detail">Sold out</span>
</chatty-cart-notice>
`;
}
Current (React), being replaced
Surface admin inbox Light Dark Desktop Mobile
Kết quả chỉ đọc trong inbox.
Show code cart-notice.jsx Wrap code lines Copy import React from 'react';
import {CartNotice} from '@avada/chatty-ui/primitives/CartNotice.jsx';
export function Catalogue({surface}) {
return <div>
<CartNotice notice={{kind: 'added', title: 'Cotton shirt'}} translate={text => text} onViewCart={surface === 'admin' ? undefined : () => {}} />
<CartNotice notice={{kind: 'failure', title: 'Cotton shirt', reason: 'Sold out'}} translate={text => text} />
</div>;
}
Import / element
Component / element
Import / file
Scope root
CartNotice
@avada/chatty-ui/primitives/CartNotice.jsx
.inbox-v2
Anatomy
Part
Element
1
Section chứa icon, nhãn và nội dung.
2
Nút View cart tùy chọn ở kết quả thành công.
Placement / order
Context
Order
Notice
Icon trước body; nhãn, title, reason rồi action.
Props
Sizes
Tokens
Part
Token
Light
Dark
Text
--chatty-color-text
Fallback #303030
No Dark skin
Failure
--chatty-color-critical
Fallback #c5280 c
No Dark skin
States
State
Trigger
Visual change (values)
ARIA/attribute
Success
kind added
Icon check, có thể hiện View cart.
Native button
Failure
kind failure
Icon alert, nhãn lỗi và reason nếu có.
Không thêm role
Behaviour
Interaction
Result
View cart
Gọi handler từ caller.
Invalid notice
Trả null.
Copy
String
i18n key
Where
Added to cart
Added to cart
Nhãn success
Could not add to cart
Could not add to cart
Nhãn failure
View cart
View cart
Action success
Source
File
Evidence
API và markup
Style
Do / Don't
Accessibility
Target
Target — read the case before building
Surface
Now
Target
Source
Classic · AI Mode · Admin
Component React
Not available — new build follows Target. Element (dự kiến): chatty-cart-notice ; hiệu ứng giỏ hàng nằm ở module JS thuần, element chỉ hiển thị.
MDN: Web Components
AI Mode · Classic · Admin
Component React theo surface
Not available — new build follows Target. Port chatty-cart-notice từ mục Standard rồi chuyển caller từng surface.
Chatty UI · Chrome dùng chatty-ui theo palette light/dark của guide; specimen giữ surface riêng. Surface dùng native select để bốn nhãn vẫn vừa ở 390px.