# Slides widget

A generated deck in the chat: slides arrive as they are written, then Present fills the screen and Export hands over an editable file.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Slides widget. The deck writes itself slide by slide; then Present fills the screen and Export offers three formats. Preview: https://chatcn.dev/preview/slides-widget-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/slides-widget
```

## Usage

```tsx
import { SlidesWidget } from "@/components/ui/chatcn/pro/slides-widget"

<SlidesWidget
  title="Q1 board update"
  slides={[
    { kind: "title", title: "Q1 board update", subtitle: "Northwind · April 2026" },
    { kind: "stat", value: "$4.8M", caption: "Annual recurring revenue, up 31% on the quarter" },
    { kind: "chart", title: "New revenue by month", unit: "k", bars: [{ label: "Jan", value: 290 }, …] },
    { kind: "bullets", title: "Asks for the board", bullets: ["Approve the EU region in Q2", …] },
  ]}
  total={8}
  generating={streaming}
  onExport={(format) => exportDeck(format)}   // "pdf" | "pptx" | "gslides"
/>
```

Slides are data, not pictures: title, bullets, stat, chart and quote slides render on a 16 by 9 canvas whose type is sized in container units, so a thumbnail and a projector show the same slide at different sizes, and an assistant can write them as JSON. While the deck is generating, `total` placeholders fill the filmstrip, slides drop in as they arrive, the view follows the newest one, and the header says which slide is being written; Present and Export wait until it is done. Present fills the screen in black: arrows, space, Page Up and Down or a click move through it, and Escape returns to the chat with focus on Present. Export lists the formats and shows progress, and a failure says so under the deck. The deck keeps its own light or dark look (`deckTheme`), whatever the chat theme.

## Examples

### States

Example: States. A dark deck, the first slide on its way, and an export that failed. Preview: https://chatcn.dev/preview/slides-widget-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `title` | `string` | The deck's name |
| `slides` | `Slide[]` | `title`, `bullets`, `stat`, `chart` or `quote` slides |
| `total`, `generating` | `number`, `boolean` | Placeholders and progress while writing |
| `deckTheme` | `"light" | "dark"` | The deck's own look |
| `formats`, `onExport` |  | Export menu; throw to show the error |
| `labels` | `Partial<SlidesWidgetLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| Arrow left, right in the filmstrip | Previous or next slide |
| Arrows, Space, Page Up, Page Down while presenting | Move through the deck |
| Escape | Stop presenting |

## Accessibility

- Thumbnails are buttons named Slide 2 of 8, in a toolbar with one tab stop; the current one is marked.
- Presenting is a modal dialog named with the slide number, with focus returned on exit.

## Motion

New slides and the current slide rise in over 220 to 260 ms. Under reduced motion they appear in place.

Source: https://chatcn.dev/docs/components/slides-widget