# carouselSync

> Runs the Carousel it sits in from a hidden host anywhere inside the carousel root, so a server-rendered carousel gets the same command handling, arrow and dot state and `n / N` counts as carouselControls without the page writing an island around its viewport.

```ts
import { carouselSync } from "@sdxc/ui/mixins";
```

Runs the Carousel it sits in from a hidden host anywhere inside the carousel root, so a
server-rendered carousel gets the same command handling, arrow and dot state and `n / N`
counts as carouselControls without the page writing an island around its viewport.
It marks the root with CAROUSEL_READY_ATTRIBUTE while it runs.

## Signature

```ts
carouselSync(): MixinDescriptor<HTMLElement>
```

## Examples

```tsx
<span hidden mix={[carouselSync()]} />
```

## Used with it

The events, constants and types its module publishes, each imported from `@sdxc/ui/mixins` too.

### CAROUSEL_SLIDE_ATTRIBUTE

Attribute every Carousel slide exposes itself on. carouselControls
queries every element carrying this attribute beneath the viewport, in
document order, to resolve the slide a `--ui-goto` command targets.

#### Signature

```ts
const CAROUSEL_SLIDE_ATTRIBUTE = "data-carousel-slide"
```

### CAROUSEL_READY_ATTRIBUTE

Set on a Carousel root once carouselSync runs it, for controls that need script.

#### Signature

```ts
const CAROUSEL_READY_ATTRIBUTE = "data-carousel-ready"
```
