# Carousel dots

Dấu vị trí trang trí dưới carousel.

## Key rules

- Chấm thể hiện vị trí do caller tính và không phải nút điều khiển.
- Element `chatty-carousel-dots` ở mục Standard là chuẩn chatty-ui port theo; các mục theo surface mô tả component React đang chạy.

## Use when / Avoid

Dùng để bổ sung tín hiệu vị trí cho carousel.

### Use instead

| Component | Use when |
| --- | --- |
| `CarouselDots` | Hiện vị trí carousel bằng dấu trang trí. |
| `button` | Dùng nút khi cần điều khiển cuộn carousel. |

## Live preview

Example (Standard) — Element chatty-carousel-dots: 5, 3 và 8 chấm; token chuẩn.

```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>
```

Example (Standard) — Element chatty-carousel-dots trên AI Mode.

```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>
```

Example (Current (React), being replaced) — Dấu vị trí với dữ liệu cục bộ.

```jsx
import React from 'react';
import {CarouselDots} from '@scripttag/platform/components/CarouselDots/CarouselDots.jsx';

export function Catalogue() {
  return <CarouselDots count={4} active={1} />;
}
```

Example (Current (React), being replaced) — Dấu vị trí trong AI Mode.

```jsx
import React from 'react';
import {CarouselDots} from '@scripttag/platform/components/CarouselDots/CarouselDots.jsx';

export function Catalogue() {
  return <CarouselDots count={4} active={1} />;
}
```

## Standard

Example (Standard) — Element chatty-carousel-dots: 5, 3 và 8 chấm; token chuẩn.

```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>
```

Prototype  (cùng `carousel-dots.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ấm chỉ trang trí và ẩn với công nghệ hỗ trợ; carousel tự nêu vị trí và giữ control. Chưa surface nào dùng element thật; các mục bên dưới mô tả React đang chạy.

### Element

| Element | Module |
| --- | --- |
| `chatty-carousel-dots` | @avada/chatty-ui/elements/carousel-dots.js |

### API

| Kind | Name | Type | Default | Description |
| --- | --- | --- | --- | --- |
| attribute | `count` | number | `0` | Số chấm. |
| attribute | `active` | number | `0` | Vị trí chấm đang active, tính từ 0. |
| part | `base` | – | – | Hàng chấm. |
| part | `dot` | – | – | Mỗi chấm; chấm active có thêm part active. |
| part | `active` | – | – | Chấm đang active. |
| css-property | `--chatty-carousel-dots-color` | – | – | Màu chấm; chấm thường trộn 24% màu này. |
| css-property | `--chatty-carousel-dots-active-width` | – | – | Chiều rộng chấm active; mặc định space-500. Khoảng cách phía trên do caller đặt. |

## Classic

### Import / element

| Component / element | Import / file | Scope root |
| --- | --- | --- |
| `CarouselDots` | @scripttag/platform/components/CarouselDots/CarouselDots.jsx | .Avada-Faqs_Popup |

### Anatomy

| Part | Element |
| --- | --- |
| 1 | Wrapper chứa một span cho mỗi mục. |

### Placement / order

| Context | Order |
| --- | --- |
| Carousel | Dấu nằm sau track trong caller. |

### Props

| Prop | Type | Values | Default | Notes |
| --- | --- | --- | --- | --- |
| `count` | number | Số mục | Caller | Quyết định số dấu. |
| `active` | number | Chỉ số hiện tại | Caller | Chọn dấu có class is-active. |

### Sizes

| Size | Height | Padding | Gap | Radius | Font role (px/rem) | Hit target | Breakpoint / mechanism |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Dot | 6px | Không có | 6px | 999px | Không có | Không tương tác | Rộng 6px; active rộng 18px |

### Tokens

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Ink | `--carousel-dots-ink` | Kế thừa khi thiếu token | Theo caller |

### States

| State | Trigger | Visual change (values) | ARIA/attribute |
| --- | --- | --- | --- |
| Active | Index bằng active | Rộng 18px và dùng currentColor. | Wrapper aria-hidden |
| Reduced motion | prefers-reduced-motion reduce | Không transition. | Không đổi |

### Behaviour

| Interaction | Result |
| --- | --- |
| Caller thay index | Đổi class của dấu active. |

### Copy

| String | i18n key | Where |
| --- | --- | --- |
| Not available | Not available | Không có copy. |

### Source

| File | Evidence |
| --- | --- |
|  | API và markup |
|  | Style và motion |

## AI Mode

### Import / element

| Component / element | Import / file | Scope root |
| --- | --- | --- |
| `CarouselDots` | @scripttag/platform/components/CarouselDots/CarouselDots.jsx | .chatty-ai-mode |

### Anatomy

| Part | Element |
| --- | --- |
| 1 | Wrapper chứa một span cho mỗi mục. |

### Placement / order

| Context | Order |
| --- | --- |
| Carousel | Dấu nằm sau track trong caller. |

### Props

| Prop | Type | Values | Default | Notes |
| --- | --- | --- | --- | --- |
| `count` | number | Số mục | Caller | Quyết định số dấu. |
| `active` | number | Chỉ số hiện tại | Caller | Chọn dấu có class is-active. |

### Sizes

| Size | Height | Padding | Gap | Radius | Font role (px/rem) | Hit target | Breakpoint / mechanism |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Dot | 6px | Không có | 6px | 999px | Không có | Không tương tác | Rộng 6px; active rộng 18px |

### Tokens

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Ink | `--carousel-dots-ink` | Kế thừa khi thiếu token | Theo caller |

### States

| State | Trigger | Visual change (values) | ARIA/attribute |
| --- | --- | --- | --- |
| Active | Index bằng active | Rộng 18px và dùng currentColor. | Wrapper aria-hidden |
| Reduced motion | prefers-reduced-motion reduce | Không transition. | Không đổi |

### Behaviour

| Interaction | Result |
| --- | --- |
| Caller thay index | Đổi class của dấu active. |

### Copy

| String | i18n key | Where |
| --- | --- | --- |
| Not available | Not available | Không có copy. |

### Source

| File | Evidence |
| --- | --- |
|  | API và markup |
|  | Style và motion |

## Do / Don't

Do: giữ caller đồng bộ index với vị trí cuộn.

Don't: coi dấu trang trí là điều khiển tương tác.

## Accessibility

| Surface | Role / name | Keyboard / focus | Live region | Contrast pair / ratio |
| --- | --- | --- | --- | --- |
| Classic | Wrapper aria-hidden | Không focusable | Không có | Theo màu của caller |
| AI Mode | Wrapper aria-hidden | Không focusable | Không có | Theo màu của caller |

## Target

```target
| Surface | Now | Target |
| --- | --- | --- |
| Classic · AI Mode | Component React của kit chung | Not available — new build follows Target. Port `chatty-carousel-dots` từ mục Standard; carousel của khối sản phẩm ghép element này. |
```


- [WAI-ARIA APG — carousel](https://www.w3.org/WAI/ARIA/apg/patterns/carousel/)
