Dùng Sidebar qua SidebarHost: mỗi lúc chỉ một sidebar, nội dung đăng ký trong SIDEBAR_REGISTRY.
Desktop là cột phải rộng 430px, không có nền chắn; mobile (≤899px) là slide-over phủ cả widget và có scrim.
Header cao 52px gồm tiêu đề và nút đóng; panel mobile dùng --radius-panel.
Esc đóng, Tab bị giữ trong sidebar, focus vào nút đóng khi mở và trả về nơi mở khi đóng xong.
Element chatty-sheet ở mục Standard là chuẩn chatty-ui port theo; mục AI Mode mô tả component React đang chạy.
On this page
Use when / Avoid
Dùng cho chi tiết sản phẩm, đơn hàng hoặc giỏ hàng cần vùng đọc riêng mà vẫn giữ hội thoại. Classic và Admin chưa có sidebar dùng chung trong code. Danh sách hành động ngắn dùng menu; tray hành động theo lựa chọn ở đáy panel mobile dùng SelectionSheet.
Use instead
Component
Use when
Sidebar
Chi tiết sản phẩm, đơn hàng hoặc giỏ hàng cần cột riêng; chỉ AI Mode.
SelectionSheet
Tray hành động cho sản phẩm đã chọn, cố định ở đáy panel và chỉ mobile.
ComposerMenu
Danh sách hành động ngắn quanh composer; xem trang Menu / popover.
Modal
Dialog overlay cấp thấp của kit có focus trap và Esc; không phải sidebar.
Live preview
Standard
Standard
LightDarkDesktopMobile
Element chatty-sheet layout column: cột phải cạnh hội thoại.
Show codechatty-sheet.element.jsWrap code linesCopy
<chatty-sheet open style="height: 360px; margin-inline-start: auto">
<span slot="heading">Classic leather boot</span>
<p style="margin: 0">Full-grain leather, a cushioned insole and a rubber sole. Free returns within 30 days.</p>
</chatty-sheet>
Prototype (cùng sheet.styles.js và , dùng FocusController) là chuẩn: chatty-ui port 1:1 các file này, và chatty-ui/custom-elements.json sinh từ chính prototype. Sheet không lên top layer: overlay chỉ phủ tổ tiên có position (widget), không phủ cả trang của merchant. Layout column không modal (role complementary): Tab đi ra composer và thread được. Chỉ overlay là modal (role dialog, aria-modal) và giữ Tab bên trong. Hai layout đều chuyển focus tới nút đóng khi mở và đóng bằng Esc. Chưa có kéo để đóng nên element không vẽ tay nắm. Chưa surface nào dùng element thật; mục AI Mode bên dưới mô tả React đang chạy.
Element
Element
Module
chatty-sheet
@avada/chatty-ui/elements/sheet.js
API
Kind
Name
Type
Default
Description
attribute
open
boolean
false
Sheet đang mở; mở sau khi gắn vào trang thì chuyển focus tới nút đóng. Sheet mở sẵn lúc gắn vẫn có Esc và trap nhưng không lấy focus.
attribute
layout
column, overlay
'column'
column là cột phải cạnh hội thoại, không modal; overlay trượt lên phủ tổ tiên có position, kèm scrim, modal và giữ Tab.
attribute
label
string
''
Tên truy cập; để trống thì lấy từ slot heading.
attribute
close-label
string
'Close'
Tên truy cập của nút đóng.
event
click
MouseEvent
–
Click native của nút đóng, nổi ra ngoài shadow root.
Sidebar thật mở với tiêu đề, nút đóng và thân nội dung: nút Desktop của preview hiện cột phải, nút Mobile hiện slide-over có handle, nút giỏ hàng và scrim.
Show codesheet-sidebar.jsxWrap code linesCopy
import React, {useRef} from 'react';
import {Sidebar} from '@scripttag/v2/components/Sidebar/Sidebar.jsx';
import {useIsMobileViewport} from '@scripttag/v2/hooks/useIsMobileViewport.js';
// Defines --aimode-sidebar-open-width (430px) on .chatty-ai-mode; the widget loads it with the panel.
import '@scripttag/v2/components/Panel.scss';
const Title = () => 'Order #1042';
const noop = () => {};
function Body() {
return <p style={{margin: 12}}>Body content</p>;
}
// The frame follows the page's Desktop / Mobile switch: wider than 899px it is the desktop right column, otherwise the real slide-over. The frame root already carries .chatty-ai-mode and .is-mobile, so the specimen only supplies the positioned box the widget root would be.
export function Catalogue() {
const ref = useRef(null);
const isMobile = useIsMobileViewport(ref);
return (
<div
ref={ref}
style={{
position: 'relative',
height: isMobile ? 480 : 360,
overflow: 'hidden',
display: 'flex',
justifyContent: 'flex-end'
}}
>
<Sidebar open showBag={isMobile} title={Title} onClose={noop} onExited={noop}>
<Body />
</Sidebar>
</div>
);
}
Import / element
Component / element
Import / file
Scope root
Sidebar
@scripttag/v2/components/Sidebar/Sidebar.jsx
.chatty-ai-mode[data-theme] .chatty-sidebar
SidebarHost
@scripttag/v2/components/Sidebar/SidebarHost.jsx
.chatty-ai-mode[data-theme] .chatty-sidebar
Anatomy
Part
Element
1
Scrim chatty-sidebar-scrim, aria-hidden="true", chỉ hiện trên mobile.
2
Container chatty-sidebar với role="dialog" và aria-modal="true".
3
Handle kéo chatty-sidebar-handle, chỉ hiện trên mobile.
4
Header: tiêu đề chatty-sidebar-title và nhóm chatty-sidebar-actions.
5
Nút đóng với aria-label Close; nút giỏ hàng chỉ khi showBag.
6
Thân chatty-sidebar-body chứa children, caller tự cuộn trong view của mình.
Placement / order
Context
Order
Desktop
Cột phải trong lưới panel, không có nền chắn; panel mở rộng thêm 430px khi has-sidebar.
Mobile
Slide-over gắn ở root widget, phủ cả widget kể cả vùng composer; kích thước widget không đổi.
Trong sidebar
Handle, header (tiêu đề rồi nhóm nút giỏ hàng và đóng), thân.
Props
Prop
Type
Values
Default
Notes
open
boolean
true / false
Caller
Điều khiển class mở, inert và focus.
title
component
Component không props
Caller
Render trong header.
titlePhase
string
pha swap của view
rest
Chọn class chatty-view- cho tiêu đề.
showBag
boolean
true / false
Caller
Icon giỏ hàng trong header, chỉ hiển thị trên mobile.
onClose
Function
Handler
Caller
Gọi từ nút đóng, scrim, Esc và kéo handle.
onExited
Function
Handler
Caller
Gọi một lần sau khi animation thoát kết thúc.
children
ReactNode
Nội dung view
Caller
Render trong thân sidebar.
Sizes
Size
Height
Padding
Gap
Radius
Font role (px/rem)
Hit target
Breakpoint / mechanism
Cột desktop
100% của panel
Không khai báo
Không khai báo
Không khai báo
Không có chữ
Theo nội dung
width 430px qua --aimode-sidebar-open-width; border-left1px