On this page

chatty-divider

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

Copy page as MarkdownRead Markdown ↗

Key rules

  • chatty-divider khai báo 3 attribute, 0 property không có attribute, 0 event, 1 slot, 2 part và 2 CSS custom property.
  • Import 1 module @avada/chatty-ui/elements/divider.js là define chatty-divider; 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

A hairline between blocks or a centered day pill, with optional slotted text. Class ChattyDivider.

Attributes

Name Property Type Default Description
orientation orientation 'horizontal' | 'vertical' 'horizontal' Horizontal hairline or vertical rule.
variant variant 'line' | 'pill' 'line' Hairlines or a centered day pill (horizontal only).
label label string '' Accessible name of the separator, e.g. the date of a day divider.

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 Optional horizontal label, between hairlines or inside the day pill.

Parts

Name Description
base Separator box.
label Text wrapper; hidden when the slot is empty.

CSS custom properties

Name Default Description
--chatty-divider-color – Hairline colour.
--chatty-divider-spacing – Block margin around a horizontal divider (inline for vertical).

Usage

import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/divider.js';
<chatty-divider style="inline-size:100%"></chatty-divider>
<chatty-divider label="Today" style="inline-size:100%">Today</chatty-divider>
<chatty-divider orientation="vertical" style="block-size:24px"></chatty-divider>

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: trạng thái mặc định và nội dung mẫu của element.

Show code
chatty-divider.element.jsWrap code linesCopy
<chatty-divider style="inline-size:100%"></chatty-divider>
<chatty-divider label="Today" style="inline-size:100%">Today</chatty-divider>
<chatty-divider orientation="vertical" style="block-size:24px"></chatty-divider>
Standard
LightDarkDesktopMobile

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

Show code
chatty-divider.element.jsWrap code linesCopy
<chatty-divider variant="pill" label="Today" style="inline-size:100%"
    >Today</chatty-divider
  >

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-divider.element.jsWrap code linesCopy
<chatty-divider style="inline-size:100%"></chatty-divider>
<chatty-divider label="Today" style="inline-size:100%">Today</chatty-divider>
<chatty-divider orientation="vertical" style="block-size:24px"></chatty-divider>
Part Element Source
1 CSS part base chatty-ui/custom-elements.json
2 CSS part label chatty-ui/custom-elements.json

Keyboard

No element-specific keys.

Source

  • chatty-ui/custom-elements.json