# Plug connect

Connecting a server as plugging something in: the plug seats, the cable marches, then turns live.

Also called: connect animation, plug animation.

> 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: Connect a server, plugged in. The plug slides into the socket and seats with a small push; once the server answers the cable turns live and a pulse runs along it. Refused, it springs back out with the reason. Preview: https://chatcn.dev/preview/plug-connect-demo

The app's socket and the server's plug sit apart on one cable. Connecting slides the plug across until its prongs sink into the socket with a small push, and the cable marches while the handshake runs. When the server answers, a ring flashes at the joint, the cable turns green from the joint outward and one pulse of data runs home. Refused, the plug springs back out and the line says why.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/plug-connect
```

## Usage

```tsx
import { PlugConnect } from "@/components/ui/chatcn/pro/plug-connect"

<PlugConnect from="chatcn" to="Linear MCP" status={status} detail={status === "connected" ? "14 tools" : error} onConnect={connect} />
```

## Examples

### States

Example: Every connection state. Unplugged, plugging in while it waits for sign in, connected with its tools, and refused with the reason. Preview: https://chatcn.dev/preview/plug-connect-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `status` | `"idle" | "connecting" | "connected" | "error"` |  |
| `from` / `to` | `string` | The app and the server |
| `detail` | `string` | After Connected, or the reason it failed |
| `onConnect` | `() => void` | Shows Connect, or Try again after an error |

## Accessibility

- The status line is a polite `role="status"`; the drawing is hidden.

## Motion

- The plug slides 480 ms with a 1.5 px overshoot; a refusal springs it back 560 ms. The live cable draws from the joint out with `pathLength`.
- Reduced motion: the plug and cable change state without moving.

Source: https://chatcn.dev/docs/components/plug-connect