On this page

Link

Link trong câu trả lời là anchor do Markdown renderer tạo; màu đến từ biến `--chatty-link` của từng surface.

Copy page as MarkdownRead Markdown ↗

Key rules

  • Classic: link Markdown dùng --chatty-link (merchant --faqsTextColor), fallback #303030 Light, #eee Dark.
  • AI Mode: --chatty-link trỏ về --link, và --link bằng --vib-1 ở cả hai theme.
  • Admin: bubble inbox đặt --chatty-link từ --chatty-color-text-link; ngoài scope dùng fallback #2563eb.
  • Mọi anchor Markdown đều gạch chân bằng inline style và mở tab mới; scheme ngoài allowlist bị đổi thành fragment an toàn.
  • Element chatty-link ở 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

Use when / Avoid

Dùng anchor Markdown cho điều hướng trong nội dung câu trả lời. Thao tác đổi trạng thái (gửi, lưu) dùng Button. Không có component Link độc lập trong chatty-ui: đừng import một tên như vậy.

Use instead

Component Use when
Markdown Câu trả lời có link; renderer tạo anchor.
Button Hành động có kết quả rõ ràng; truyền href thì Button render anchor theo kit đó.

Live preview

Standard

Standard
LightDarkDesktopMobile

Element chatty-link: link ngoài, mailto và fragment.

Show code
chatty-link.element.jsWrap code linesCopy
<chatty-link href="https://example.com/delivery">Delivery policy</chatty-link>
<chatty-link href="mailto:help@example.com">Email us</chatty-link>
<chatty-link href="#orders">Your orders</chatty-link>

Prototype (cùng link.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.

Element

Element Module
chatty-link @avada/chatty-ui/elements/link.js

API

Kind Name Type Default Description
attribute href string '' URL http, https, mailto, tel, tương đối hoặc fragment; scheme khác render chữ thường.
attribute target _blank, _self '' Để trống thì link ngoài origin mở tab mới với rel noopener noreferrer.
event click MouseEvent – Kích hoạt native.
slot default – – Chữ link ở light DOM để index và dịch được.
part base – – Anchor native.
css-property --chatty-link-color – – Màu chữ và gạch chân.

Classic

Standard
LightDarkDesktopMobile

Element chatty-link: link ngoài, mailto và fragment.

Show code
chatty-link.element.jsWrap code linesCopy
<chatty-link href="https://example.com/delivery">Delivery policy</chatty-link>
<chatty-link href="mailto:help@example.com">Email us</chatty-link>
<chatty-link href="#orders">Your orders</chatty-link>
Standard
LightDarkDesktopMobile

Cùng tab và scheme không an toàn render chữ thường.

Show code
chatty-link.element.jsWrap code linesCopy
<chatty-link href="https://example.com/faq" target="_self">FAQ in the same tab</chatty-link>
<chatty-link href="javascript:alert(1)">Unsafe scheme renders text</chatty-link>
Current (React), being replaced
LightDarkDesktopMobile

Markdown thật với link; anchor lấy màu từ `--chatty-link` của Classic.

Show code
link.jsxWrap code linesCopy
import React from 'react';
import {Markdown} from '@avada/chatty-ui/primitives/Markdown.js';
export function Answer() {
  return <Markdown text="Read our [delivery policy](https://example.com/delivery) before ordering." />;
}
Current (React), being replaced Do
Show code
link.jsxWrap code linesCopy
import React from 'react';
import {Markdown} from '@avada/chatty-ui/primitives/Markdown.js';
export function Answer() {
  return <Markdown text="Read our [delivery policy](https://example.com/delivery) before ordering." />;
}

Viết link có nghĩa trong câu; giữ gạch chân mặc định của anchor.

Import / element

Component / element Import / file Scope root
Markdown @avada/chatty-ui/primitives .chatty-widget > #Avada-FAQ_Widget > .Avada-Faqs_Popup

Anatomy

Part Element
1 Native a có href, tạo từ cú pháp link hoặc URL trần.
2 Label là nội dung inline của link trong Markdown.

Placement / order

Context Order
Câu trả lời sản phẩm Markdown đặt trong ProductDetail__QuestionAnswer; link nằm trong dòng văn bản.

Props

Prop Type Values Default Notes
text string Markdown empty Chứa cú pháp link, URL trần hoặc email.
className string CSS classes undefined Áp lên div bao ngoài, không lên anchor.
onLinkClick function href, event undefined Gọi khi link được theo bằng click hoặc middle click.

Sizes

Size Height Padding Gap Radius Font role (px/rem) Hit target Breakpoint / mechanism
Inline Theo dòng Không khai báo Không khai báo Không khai báo Kế thừa chữ cha Native inline box Không override theo viewport

Tokens

Part Token Light Dark
Link color --chatty-link Merchant --faqsTextColor, fallback #303030 Merchant --faqsTextColor, fallback #eee
Underline textDecoration underline underline
Underline thickness / offset inline style 1px / 2px 1px / 2px

States

State Trigger Visual change (values) ARIA/attribute
Default render --chatty-link color, underline Native link
Hover pointer Không có rule riêng trong Markdown Native
Focus-visible keyboard Không có rule riêng trong Markdown; browser vẽ outline Native focus
Unsafe scheme href ngoài allowlist href thành # Native link

Behaviour

Interaction Result
Link ngoài target="_blank" và rel="noopener noreferrer".
Deep link Href trong DEEP_LINK gọi window.ChattyJS.openWidget thay vì mở tab.
Link tracking onLinkClick nhận href; mặc định không theo dõi.

Copy

String i18n key Where
Link label Caller-owned Nội dung do câu trả lời cung cấp

Source

File Evidence
Allowlist, deep link, API
Anchor render
linkStyle
Classic --chatty-link

AI Mode

Standard
LightDarkDesktopMobile

Element chatty-link: link ngoài, mailto và fragment.

Show code
chatty-link.element.jsWrap code linesCopy
<chatty-link href="https://example.com/delivery">Delivery policy</chatty-link>
<chatty-link href="mailto:help@example.com">Email us</chatty-link>
<chatty-link href="#orders">Your orders</chatty-link>
Standard
LightDarkDesktopMobile

Cùng tab và scheme không an toàn render chữ thường.

Show code
chatty-link.element.jsWrap code linesCopy
<chatty-link href="https://example.com/faq" target="_self">FAQ in the same tab</chatty-link>
<chatty-link href="javascript:alert(1)">Unsafe scheme renders text</chatty-link>
Current (React), being replaced
LightDarkDesktopMobile

Markdown thật trong scope AI Mode.

Show code
link.jsxWrap code linesCopy
import React from 'react';
import {Markdown} from '@avada/chatty-ui/primitives/Markdown.js';
export function Answer() {
  return <Markdown text="Read our [delivery policy](https://example.com/delivery) before ordering." />;
}

Import / element

Component / element Import / file Scope root
Markdown @avada/chatty-ui/primitives .chatty-ai-mode[data-theme]

Anatomy

Part Element
1 Native a từ Markdown, trong .aimode-chat.
2 Rule a của thread lặp lại màu và gạch chân.

Placement / order

Context Order
Tin nhắn chat Markdown render nội dung tin nhắn, bọc trong ClampFade.

Props

Prop Type Values Default Notes
text string Markdown empty Nội dung đã làm mượt khi streaming.
onLinkClick function href, event undefined Caller truyền để theo dõi link trong câu trả lời.

Sizes

Size Height Padding Gap Radius Font role (px/rem) Hit target Breakpoint / mechanism
Inline Theo dòng Không khai báo Không khai báo Không khai báo Kế thừa chữ cha Native inline box Không override theo viewport

Tokens

Part Token Light Dark
Link color --chatty-link var(--link) var(--link)
Link role --link var(--vib-1) var(--vib-1)
Text --vib-1 rgba(20,19,24,0.94) rgba(255,255,255,0.96)

States

State Trigger Visual change (values) ARIA/attribute
Default render --link color, underline 1px, offset 2px Native link
Hover pointer Không có rule riêng Native

Behaviour

Interaction Result
Link ngoài target="_blank" và rel="noopener noreferrer".
Sync màu Markdown đặt màu inline nên --chatty-link và a phải khớp nhau.

Copy

String i18n key Where
Link label Caller-owned Nội dung do câu trả lời cung cấp

Source

File Evidence
Biến link của AI Mode
Caller Markdown

Admin

Standard
LightDarkDesktopMobile

Element chatty-link: link ngoài, mailto và fragment.

Show code
chatty-link.element.jsWrap code linesCopy
<chatty-link href="https://example.com/delivery">Delivery policy</chatty-link>
<chatty-link href="mailto:help@example.com">Email us</chatty-link>
<chatty-link href="#orders">Your orders</chatty-link>
Standard
LightDarkDesktopMobile

Cùng tab và scheme không an toàn render chữ thường.

Show code
chatty-link.element.jsWrap code linesCopy
<chatty-link href="https://example.com/faq" target="_self">FAQ in the same tab</chatty-link>
<chatty-link href="javascript:alert(1)">Unsafe scheme renders text</chatty-link>
Current (React), being replaced
LightDarkDesktopMobile

Markdown thật trong frame Admin; `--chatty-link` chưa được frame đặt nên anchor dùng fallback.

Show code
link.jsxWrap code linesCopy
import React from 'react';
import {Markdown} from '@avada/chatty-ui/primitives/Markdown.js';
export function Answer() {
  return <Markdown text="Read our [delivery policy](https://example.com/delivery) before ordering." />;
}

Import / element

Component / element Import / file Scope root
Markdown @avada/chatty-ui/primitives .inbox-v2

Anatomy

Part Element
1 Native a từ Markdown trong class chatty-text--markdown.

Placement / order

Context Order
Tin nhắn bot Bot markdown render bằng Markdown; tin khác dùng TextRenderer.

Props

Prop Type Values Default Notes
text string Markdown empty Caller truyền text của tin nhắn.
className string CSS classes Caller Caller truyền chatty-text chatty-text--markdown.

Sizes

Size Height Padding Gap Radius Font role (px/rem) Hit target Breakpoint / mechanism
Inline Theo dòng Không khai báo Không khai báo Không khai báo Kế thừa chữ cha Native inline box Không override theo viewport

Tokens

Part Token Light Dark
Link color --chatty-link var(--chatty-color-text-link, #005bd3) trong bubble self No Dark skin
Text link --chatty-color-text-link --p-color-text-link; fallback #005bd3 No Dark skin
Fallback --chatty-link #2563eb khi biến không được đặt No Dark skin

States

State Trigger Visual change (values) ARIA/attribute
Default render --chatty-link color, underline Native link

Behaviour

Interaction Result
Link ngoài target="_blank" và rel="noopener noreferrer".

Copy

String i18n key Where
Link label Caller-owned Nội dung do tin nhắn cung cấp

Source

File Evidence
Scope và màu link của bubble
Caller Markdown

Do / Don't

Accessibility

Surface Role / name Keyboard / focus Live region Contrast pair / ratio
Classic a có href, tên từ label Native Tab/Enter; không focus ring riêng Caller-owned Merchant color; fallback 13.20:1Measured(#303030 / #ffffff = 13.20:1)
AI Mode a có href, tên từ label Native Tab/Enter; không focus ring riêng Caller-owned Phụ thuộc --vib-1 trên nền glass
Admin a có href, tên từ label Native Tab/Enter; focus-visible của .inbox-v2 Caller-owned 5.70:1Measured(#005bd3 / #f7f7f7 = 5.70:1)

Target