# chatty-carousel-dots

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

## Key rules

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

## Overview

Decorative position marks under a carousel: `count` dots, the one at `active` stretched. Hidden from assistive technology; the carousel itself names the position and owns the controls. Class `ChattyCarouselDots`.

### Attributes

| Name | Property | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `count` | `count` | `number` | `0` | Number of dots (slides). |
| `active` | `active` | `number` | `0` | Zero-based index of the current slide; it draws the wide dot. |

### Properties

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

Not declared in the manifest.

### Events

Not declared in the manifest.

### Slots

Not declared in the manifest.

### Parts

| Name | Description |
| --- | --- |
| `base` | Dot row. |
| `dot` | Each dot; the active one also has part active. |
| `active` | The active dot. |

### CSS custom properties

| Name | Default | Description |
| --- | --- | --- |
| `--chatty-carousel-dots-color` | – | Dot ink; inactive dots mix it at 24%. |
| `--chatty-carousel-dots-active-width` | – | Width of the active dot. |

## Usage

```js
import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/carousel-dots.js';
```

```html
<chatty-carousel-dots style="width: 100%" count="5" active="0"></chatty-carousel-dots>
<chatty-carousel-dots style="width: 100%" count="3" active="1"></chatty-carousel-dots>
<chatty-carousel-dots style="width: 100%" count="8" active="7"></chatty-carousel-dots>
```

## 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ộ.

Example (Standard) — Default: trạng thái mặc định và nội dung mẫu của element.

```html
<chatty-carousel-dots style="width: 100%" count="5" active="0"></chatty-carousel-dots>
<chatty-carousel-dots style="width: 100%" count="3" active="1"></chatty-carousel-dots>
<chatty-carousel-dots style="width: 100%" count="8" active="7"></chatty-carousel-dots>
```

## 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ả.

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

```html
<chatty-carousel-dots style="width: 100%" count="5" active="0"></chatty-carousel-dots>
<chatty-carousel-dots style="width: 100%" count="3" active="1"></chatty-carousel-dots>
<chatty-carousel-dots style="width: 100%" count="8" active="7"></chatty-carousel-dots>
```

| Part | Element | Source |
| --- | --- | --- |
| 1 | CSS part `base` | chatty-ui/custom-elements.json |
| 2 | CSS part `dot` | chatty-ui/custom-elements.json |
| 3 | CSS part `active` | chatty-ui/custom-elements.json |

## Keyboard

No element-specific keys.

### Source

- chatty-ui/custom-elements.json
