On this page Key rules Use when / Avoid Live preview Standard Admin · Knowledge files Do / Don't Accessibility Target Components
Badge Nhãn ngắn của kit chung; Knowledge files bọc nó bằng class và data-tone riêng.
Copy page as Markdown Read Markdown ↗
Key rules
Dùng Badge với variant="outline" và class kb-ide__badge; màu theo data-tone.
CSS trang khai báo chữ 11px, weight 500, bo 4px, padding 1px 5px.
Badge là div không tương tác; nghĩa của status phải nằm trong chữ, không chỉ trong màu.
Element chatty-badge ở 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 Admin · Knowledge files Import / element Anatomy Placement / order Props Sizes Tokens States Behaviour Copy Source Do / Don't Accessibility Target Use when / Avoid
Dùng cho nhãn status ngắn cạnh một đối tượng. Không dùng làm nút và không nhét câu dài. Wrapper KnowledgeBadge có trong source nhưng hiện chưa có file nào import nó; các nhãn đang hiện trong màn Knowledge files gọi Polaris Badge.
Use instead
Component
Use when
Badge
Nhãn status của kit chung, dùng class trang cho màu.
Badge
Màn Knowledge files hiện gọi Polaris Badge với tone, không phải kit.
Live preview
Standard
Standard
Surface admin · Knowledge files Light Dark Desktop Mobile
Element chatty-badge: variant, size và tone; token admin, không màu merchant.
Show code chatty-badge.element.js Wrap code lines Copy <chatty-badge>New</chatty-badge>
<chatty-badge variant="secondary">Draft</chatty-badge>
<chatty-badge variant="tertiary">Covered</chatty-badge>
<chatty-badge size="sm">3</chatty-badge>
<chatty-badge size="lg">Open</chatty-badge>
<chatty-badge tone="critical">Failed</chatty-badge>
<chatty-badge tone="success">Synced</chatty-badge>
<chatty-badge tone="caution">Pending</chatty-badge>
<chatty-badge variant="secondary" tone="success">Active</chatty-badge>
<chatty-badge variant="tertiary" tone="critical">Not covered</chatty-badge>
Prototype (cùng badge.styles.js và ) là chuẩn: chatty-ui port 1:1 các file này, và chatty-ui/custom-elements.json sinh từ chính prototype. Chưa surface nào dùng element thật; các mục theo surface bên dưới mô tả React đang chạy. Knowledge files vẫn chuyển sang Polaris theo Target; preview admin-kb chỉ để xem element dưới token admin.
Element
Element
Module
chatty-badge
@avada/chatty-ui/elements/badge.js
API
Admin · Knowledge files
Standard
Surface admin · Knowledge files Light Dark Desktop Mobile
Element chatty-badge: variant, size và tone; token admin, không màu merchant.
Show code chatty-badge.element.js Wrap code lines Copy <chatty-badge>New</chatty-badge>
<chatty-badge variant="secondary">Draft</chatty-badge>
<chatty-badge variant="tertiary">Covered</chatty-badge>
<chatty-badge size="sm">3</chatty-badge>
<chatty-badge size="lg">Open</chatty-badge>
<chatty-badge tone="critical">Failed</chatty-badge>
<chatty-badge tone="success">Synced</chatty-badge>
<chatty-badge tone="caution">Pending</chatty-badge>
<chatty-badge variant="secondary" tone="success">Active</chatty-badge>
<chatty-badge variant="tertiary" tone="critical">Not covered</chatty-badge>
Standard
Surface admin · Knowledge files Light Dark Desktop Mobile
Element chatty-badge size sm viền như nhãn Knowledge files.
Show code chatty-badge.element.js Wrap code lines Copy <chatty-badge size="sm" variant="tertiary">Draft</chatty-badge>
<chatty-badge size="sm" variant="tertiary" tone="success">Covered</chatty-badge>
<chatty-badge size="sm" variant="tertiary" tone="caution">Pending</chatty-badge>
<chatty-badge size="sm" variant="tertiary" tone="critical">Not covered</chatty-badge>
Current (React), being replaced
Surface admin · Knowledge files Light Dark Desktop Mobile
Badge outline với class Knowledge files; dữ liệu cục bộ.
Show code badge.jsx Wrap code lines Copy import React from 'react';
import {Badge} from '@avada/chatty-ui/components/badge.js';
export function Status() {
return <div><Badge variant="outline" className="kb-ide__badge" data-tone="covered">Covered</Badge><Badge variant="outline" className="kb-ide__badge">99+</Badge></div>;
}
Import / element
Component / element
Import / file
Scope root
Badge
@avada/chatty-ui/components/badge.js
.kb-ide-page > .kb-ide
Anatomy
Part
Element
1
Root div của Badge mang class kit, className và props.
2
Nội dung children trong root; caller cấp chữ.
Placement / order
Context
Order
Wrapper trang
KnowledgeBadge render một Badge duy nhất với children; không có icon.
Props
Sizes
Tokens
Part
Token
Light
Dark
Base text
--p-color-text-secondary
#616161
No Dark skin
Base fill
--p-color-bg-surface-secondary
#f7 f7 f7
No Dark skin
Base border
--p-color-border-secondary
#ebebeb
No Dark skin
error / conflict text
--p-color-text-critical
#8 e0 b21
No Dark skin
error / conflict fill
--p-color-bg-surface-critical
#fee8 eb
No Dark skin
error / conflict border
--p-color-border-critical-secondary
#8 e0 b21
No Dark skin
warning / pending / partial text
--p-color-text-caution
#4 f4700
No Dark skin
warning / pending / partial fill
--p-color-bg-surface-caution
#fff8 db
No Dark skin
warning / pending / partial border
--p-color-border-caution-secondary
Không khai báo trong Polaris 13.9.5
No Dark skin
audited / covered text
--p-color-text-success
#014 b40
No Dark skin
audited / covered fill
--p-color-bg-surface-success
#cdfed4
No Dark skin
audited / covered border
--p-color-border-success-secondary
Không khai báo trong Polaris 13.9.5
No Dark skin
draft text
--p-color-text-link
#005 bd3
No Dark skin
draft fill
--p-color-bg-surface-info
#eaf4 ff
No Dark skin
draft border
--p-color-border-info-secondary
Không khai báo trong Polaris 13.9.5
No Dark skin
States
State
Trigger
Visual change (values)
ARIA/attribute
Base
Không có data-tone
Màu theo Tokens dòng Base
Không thêm ARIA
error / conflict
data-tone = error hoặc conflict
Chữ, nền, viền theo Tokens
data-tone attribute
warning / pending / partial
data-tone = warning, pending hoặc partial
Chữ, nền, viền theo Tokens
data-tone attribute
audited / covered
data-tone = audited hoặc covered
Chữ, nền, viền theo Tokens
data-tone attribute
draft
data-tone = draft
Chữ, nền, viền theo Tokens
data-tone attribute
Behaviour
Interaction
Result
Chữ dài
Rule trang có width: fit-content và flex-shrink : 0 ; không có cắt dòng riêng.
Focus
Kit có class focus ring cho root; root là div, caller không thêm tabindex trong wrapper.
Count
Component không giới hạn hay định dạng số; children hiển thị nguyên.
Copy
String
i18n key
Where
Caller label
Caller-owned
children của wrapper
Source
File
Evidence
API và class kit
Wrapper trang
Style và tone
Do / Don't
Accessibility
Target
Target — read the case before building
Surface
Now
Target
Source
Admin · Knowledge files
Viền của tone warning, covered và draft dùng token không khai báo trong Polaris 13.9.5
Not in code yet — build with the body values. Dùng token viền có khai báo --p-color-border-caution , --p-color-border-success , --p-color-border-info ; giữ border 1px solid và radius 4px , không đổi chữ hay nền.
Admin · Knowledge files
Badge của kit chung trong Knowledge files
Not available — new build follows Target. Knowledge files không dùng chatty-*: chuyển sang Polaris Badge, vì trang admin ngoài inbox giữ Polaris.
Shopify: Built for Shopify requirements
Classic · AI Mode · Admin
Component React theo surface
Not available — new build follows Target. Port chatty-badge từ mục Standard rồi chuyển caller từng surface; Inbox Target dùng token chatty-ui literal theo giá trị 2.0 ; gỡ wrapper hiện tại ở phase 1 b trước khi chuyển caller.
Admin
Component Inbox đúng Target chưa ship
Not available — new build follows Target. Badge : neutral/caution ; info/success/warning/critical ; progress complete/partial/incomplete ; 20px , radius tag 6px , badge-label 12px /18px w500 . Dùng ở Return customer (10 ), order badges (15 ), Verified, Change request, Resolved. Không dùng component Polaris trong Inbox; giữ App Bridge cho phần khung embedded.
Shopify: Built for Shopify requirements
Ảnh Target từ mock; các trạng thái chưa xuất hiện trong ảnh vẫn là yêu cầu triển khai, không claim đã ship.
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.