# Seat manager

Members, roles and seats, with invites that catch typos and state the cost of extra seats before anything is sent.

> 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: Seat manager. Six of eight seats used. Paste three emails to see the cost of the seat you do not have. Preview: https://chatcn.dev/preview/seat-manager-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/seat-manager
```

## Usage

```tsx
import { SeatManager } from "@/components/ui/chatcn/pro/seat-manager"

<SeatManager
  members={members}            // { id, email, name?, role, status?, lastActiveAt?, you?, owner? }
  roles={[
    { id: "admin", label: "Admin", description: "Members, billing, keys and every setting" },
    { id: "member", label: "Member", description: "Chats, projects and agents" },
  ]}
  seats={8}
  seatPrice="$17.40"           // one extra seat for the rest of this period
  onInvite={(emails, role) => invite(emails, role)}
  onRoleChange={(id, role) => setRole(id, role)}
  onRemove={(id) => remove(id)}
  onResend={(id) => resend(id)}
  onAddSeats={openSeats}
/>
```

Seats draw as cells next to the count, and pending invites use seats like members do. Paste or type emails and each becomes a chip; duplicates and people already in the workspace are dropped, and anything that is not an email is named and blocks sending until it is fixed. When invites need more seats than are free, the line under the field says how many and, with `seatPrice`, what adding them costs this period, before Invite is pressed. Roles change from a menu on each row with each role's description; the owner and you are marked and cannot be changed or removed here. Invites can be resent or revoked, and removing someone says what happens to their chats and files. Search appears once there are more than eight people.

## Examples

### States

Example: States. Read only for a member, and a narrow frame. Preview: https://chatcn.dev/preview/seat-manager-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `members` | `SeatMember[]` | `{ id, email, name?, role, status?, lastActiveAt?, you?, owner? }` |
| `roles` | `SeatRole[]` | `{ id, label, description? }` |
| `seats` | `number` | Seats paid for |
| `seatPrice` | `string` | One extra seat this period, formatted |
| `onInvite` | `(emails, role) => void | Promise<void>` | Shows the invite field; throw to show the error |
| `onRoleChange`, `onRemove`, `onResend`, `onAddSeats` |  | Each shows its control |
| `now`, `locale` |  | Relative times |
| `labels` | `Partial<SeatManagerLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| Comma, Space, Enter | Turn what is typed into a chip |
| Enter on an empty field | Send the invites |
| Backspace on an empty field | Remove the last chip |
| Escape | Cancel a confirmation |

## Accessibility

- The line under the invite field is a polite live region with the hint, the seat cost or the problem.
- Role menus are radio groups named by the person.
- Confirmations open inside the row with Cancel focused.

## Motion

None beyond the spinner while an invite or removal runs.

Source: https://chatcn.dev/docs/components/seat-manager