# Route draw

A route the agent plans, drawn like a pen on a map, stop by stop.

Also called: route animation, map route.

> 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: A route drawn like a pen. The route runs leg by leg at an even speed, each stop popping up with its name as the line reaches it; when it arrives the travel time and distance count in. Preview: https://chatcn.dev/preview/route-draw-demo

The line leaves the first stop and runs leg by leg, each leg at the same speed so long ones take longer. Every stop it reaches pops up with its name, and when the line arrives the travel time and distance count in. You can follow the plan with your eye before reading a word of it.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/route-draw
```

## Usage

```tsx
import { RouteDraw } from "@/components/ui/chatcn/pro/route-draw"

<RouteDraw stops={stops} planned={ready} eta={24} distance={8.2} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `stops` | `{ id, label, x, y }[]` | On a 100 by 62 map |
| `planned` | `boolean` | Turning it on draws the route |
| `eta` / `distance` | `number` | Minutes and kilometres |

## Accessibility

- The summary line announces the time and distance once the route is drawn.

## Motion

- Legs draw with `pathLength`, sharing one pace; pins pop 320 ms. Reduced motion: the route is drawn.

Source: https://chatcn.dev/docs/components/route-draw