On this page

chatty-tab

API chuẩn của element chatty-tab, sinh từ custom-elements.json của prototype trong guide.

Copy page as MarkdownRead Markdown ↗

Key rules

  • chatty-tab khai báo 2 attribute, 0 property không có attribute, 0 event, 2 slot, 2 part và 0 CSS custom property.
  • Import 1 module @avada/chatty-ui/elements/tab.js là define chatty-tab; chunk chỉ import element nó dùng. Prototype chuẩn: trong guide.
  • Đổi tên attribute, event, slot, part hay CSS custom property là đổi API: diff của custom-elements.json phải có trong 1 MR.
On this page

Overview

One tab of a chatty-tabs list. The parent sets role, aria-selected, aria-controls and the roving tabindex; the tab assigns itself to the parent's tab slot. Class ChattyTab.

Attributes

Name Property Type Default Description
disabled disabled boolean false Skipped by the arrow keys and cannot be selected.
selected selected boolean false Set by the parent chatty-tabs; do not set it directly.

Properties

Attributes also expose the properties listed in the Property column above.

Not declared in the manifest.

Events

Not declared in the manifest.

Slots

Name Description
default Tab label.
end Trailing content, such as a count or a close control.

Parts

Name Description
base Tab box.
end Trailing content wrapper.

CSS custom properties

Not declared in the manifest.

Live preview

Component thật dùng cùng story với trang component; dữ liệu mẫu nằm trong frame cục bộ.

Standard
LightDarkDesktopMobile

Default: ví dụ giữ context cha cần thiết từ story có sẵn.

Show code
chatty-tabs.element.jsWrap code linesCopy
<chatty-tabs label="Knowledge file tools" style="width: 100%">
  <chatty-tab>Test</chatty-tab>
  <chatty-tab>Problems</chatty-tab>
  <chatty-tab>Outline</chatty-tab>
  <chatty-tab-panel>Ask a question to test this file.</chatty-tab-panel>
  <chatty-tab-panel>No problems found.</chatty-tab-panel>
  <chatty-tab-panel>Headings of the file.</chatty-tab-panel>
</chatty-tabs>
Standard
LightDarkDesktopMobile

Các variant hoặc state chính đặt cạnh nhau trong cùng ví dụ.

Show code
chatty-tabs.element.jsWrap code linesCopy
<chatty-tabs segmented activation="manual" selected-index="1" label="Order view" style="width: 100%">
  <chatty-tab>Details</chatty-tab>
  <chatty-tab>Tracking</chatty-tab>
  <chatty-tab disabled>Returns</chatty-tab>
  <chatty-tab-panel>Items and totals.</chatty-tab-panel>
  <chatty-tab-panel>In transit, arriving Friday.</chatty-tab-panel>
  <chatty-tab-panel>No returns.</chatty-tab-panel>
</chatty-tabs>

Anatomy

Số trong hình khớp bảng bên dưới. Phần chỉ hiện ở state khác được ghi Not shown; ví dụ không thêm phần tử giả.

Standard
LightDarkDesktopMobile

Anatomy: một instance mặc định riêng, có khoảng trống quanh các phần được đánh số.

Show code
chatty-tabs.element.jsWrap code linesCopy
<chatty-tabs label="Knowledge file tools" style="width: 100%">
  <chatty-tab>Test</chatty-tab>
  <chatty-tab>Problems</chatty-tab>
  <chatty-tab>Outline</chatty-tab>
  <chatty-tab-panel>Ask a question to test this file.</chatty-tab-panel>
  <chatty-tab-panel>No problems found.</chatty-tab-panel>
  <chatty-tab-panel>Headings of the file.</chatty-tab-panel>
</chatty-tabs>
Part Element Source
1 CSS part base chatty-ui/custom-elements.json
2 CSS part end chatty-ui/custom-elements.json

Keyboard

Key Action
Enter / Space Select this tab; the parent tabs owns arrow navigation.

Source

  • chatty-ui/custom-elements.json