# Chatty UI

Dùng cùng một hệ thống quy tắc để thiết kế AI Mode, Classic và admin inbox.

## Key rules

- Giữ 1 primary action trong mỗi view.
- Chuyển storefront sang mobile ở chiều rộng ≤899px.
- Dành hit target ≥44px cho control trên mobile.
- Giữ secondary text đạt contrast ≥4.5:1 trên nền sáng nhất.

## Overview

Example — Ba tầng tài liệu và ba bề mặt Chatty; chọn một tầng để mở trang bắt đầu.

```jsx
import React from 'react';

export function Overview() {
  return (
    <figure className="guide-overview" aria-label="Guide layers and surfaces">
      <style>{`
      .guide-overview{margin:0;color:var(--vib-1,#202223);font-family:inherit;font-size:14px;line-height:1.5}
      .guide-overview *{box-sizing:border-box;min-width:0}
      .guide-overview .layers{display:grid;gap:12px}
      .guide-overview .layer{display:grid;grid-template-columns:130px minmax(0,1fr);gap:20px;align-items:center;padding:20px;border:1px solid #8b8b94;border-radius:12px;color:inherit;text-decoration:none;background:var(--bg-deep,#fff)}
      .guide-overview .layer strong{font-size:17px}
      .guide-overview .layer span{line-height:1.6}
      .guide-overview a:focus-visible{outline:3px solid #786bdb;outline-offset:3px}
      .guide-overview .surface-strip{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:28px}
      .guide-overview .surface-strip figure{margin:0}
      .guide-overview img{display:block;width:100%;height:210px;object-fit:contain;object-position:center;background:#f1f2f4;border:1px solid #aaaab1;border-radius:8px}
      .guide-overview figcaption{margin-top:8px;font-size:12px;line-height:1.6}
      .guide-overview .surface-strip strong{display:block;font-size:14px;margin-bottom:4px}
      @media(max-width:520px){.guide-overview .layer{grid-template-columns:1fr;gap:6px;padding:16px}.guide-overview .surface-strip{grid-template-columns:1fr}.guide-overview img{height:220px}.guide-overview .surface-strip figure{display:grid;grid-template-columns:45% minmax(0,1fr);gap:12px;align-items:center}}
    `}</style>
      <nav className="layers" aria-label="Guide layers">
        <a className="layer" href="/foundations/typography/" target="_parent">
          <strong>Foundations</strong>
          <span>Chọn quy tắc, type role, màu, khoảng cách và chuyển động.</span>
        </a>
        <a className="layer" href="/components/button/" target="_parent">
          <strong>Components</strong>
          <span>Áp dụng quy tắc vào từng control, variant và trạng thái.</span>
        </a>
        <a className="layer" href="/patterns/waiting-streaming/" target="_parent">
          <strong>Patterns</strong>
          <span>Ghép component thành luồng có điểm bắt đầu, phản hồi và kết thúc.</span>
        </a>
      </nav>
      <div className="surface-strip" aria-label="Three Chatty surfaces">
        <figure>
          <img
            src="/previews/home-ai-mode.webp"
            width="600"
            height="571"
            alt="AI Mode với thread rộng và composer tách bên dưới"
          />
          <figcaption>
            <strong>AI Mode</strong>Thread và composer trên storefront. Nguồn: QA storefront, cắt từ
            ảnh desktop.
          </figcaption>
        </figure>
        <figure>
          <img
            src="/previews/home-classic.webp"
            width="390"
            height="844"
            alt="Classic với panel chat, thẻ sản phẩm và composer"
          />
          <figcaption>
            <strong>Classic</strong>Panel chat gọn. Nguồn: preview Product recommendation của guide.
          </figcaption>
        </figure>
        <figure>
          <img
            src="/previews/home-admin.webp"
            width="640"
            height="400"
            alt="Admin Inbox gồm danh sách hội thoại, thread và Details"
          />
          <figcaption>
            <strong>Admin Inbox</strong>Workspace xử lý hội thoại. Nguồn: bản chụp Inbox có chú
            thích vùng.
          </figcaption>
        </figure>
      </div>
      <figcaption>
        Đi từ quy tắc đến control rồi tới luồng. Ba bề mặt dùng chung ngôn ngữ thiết kế, giữ bố cục
        riêng.
      </figcaption>
    </figure>
  );
}
```

## Start here

| Area | Use |
| --- | --- |
| [Brand](https://chatty-ui-research.avada-tesla-chatty.workers.dev/brand/) | Logo, màu và luật cho ấn phẩm Chatty. |
| [Foundations](https://chatty-ui-research.avada-tesla-chatty.workers.dev/foundations/typography/) | Chọn type role, kích thước và hệ thống token. |
| [Components](https://chatty-ui-research.avada-tesla-chatty.workers.dev/components/button/) | Chọn variant, state và cách đặt label. |
| [Patterns](https://chatty-ui-research.avada-tesla-chatty.workers.dev/patterns/waiting-streaming/) | Ghép component thành luồng chờ và trả lời. |

## For agents

Đọc [llms.txt](https://chatty-ui-research.avada-tesla-chatty.workers.dev/llms.txt) để chọn tài liệu hoặc [llms-full.txt](https://chatty-ui-research.avada-tesla-chatty.workers.dev/llms-full.txt) để lấy toàn bộ quy tắc. Dùng Copy Markdown trên mỗi trang để lấy nội dung sạch.

## Surface

| Surface | Scope |
| --- | --- |
| AI Mode | Trải nghiệm mua sắm trên storefront. |
| Classic | Chat widget truyền thống trên storefront. |
| admin inbox | Hội thoại và công cụ của merchant. |


- Chatty UI team decision
- [Target size](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html)
- [Contrast](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
