# Default models

The model each kind of work starts on, limited to what the task can use and the workspace allows.

> 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: Default models. A default per kind of work: image models only for Images, blocked models disabled with the reason. Preview: https://chatcn.dev/preview/default-models-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/default-models
```

## Usage

```tsx
import { DefaultModels } from "@/components/ui/chatcn/pro/default-models"

<DefaultModels
  tasks={[
    { id: "chat", label: "Chat", description: "New conversations", only: textModelIds },
    { id: "images", label: "Images", only: imageModelIds },
  ]}
  models={models}
  allowed={allowed}
  value={{ chat: "claude-sonnet-5-5", images: "gpt-image-2" }}
  onValueChange={setDefaults}
  memberChoice={{ chat: true, images: false }}
  onMemberChoiceChange={setMemberChoice}
/>
```

Each task row is the free `model-picker`. Models the task cannot use (`only`) and models the workspace blocks (`allowed`) stay in the list, disabled with the reason, so people learn the policy instead of wondering where a model went. A default that is no longer allowed is outlined and says so. `memberChoice` adds a switch per task for whether members may change it in a chat. `model-policy` embeds it.

## Examples

### States

Example: States. A default that is no longer allowed, flagged on its row. Preview: https://chatcn.dev/preview/default-models-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `tasks` | `ModelTask[]` | `{ id, label, description?, only? }` |
| `models`, `providers` |  | From `model-picker` |
| `allowed` | `string[]` | Leave out to allow all |
| `value`, `onValueChange` | `Record<string, string>` | Model id per task |
| `memberChoice`, `onMemberChoiceChange` | `Record<string, boolean>` | Shows the switches |
| `labels` | `Partial<DefaultModelsLabels>` | Every string, for translation |

## Accessibility

- Disabled models carry their reason in the picker.
- Switches are named with the task.

## Motion

None beyond the picker's own.

Source: https://chatcn.dev/docs/components/default-models