Skip to content
Sign in
CodeEnvironment pickerMenu

Environment pickerPro

Where the agent runs: this machine, a new worktree, a cloud sandbox or an SSH host, each with its machine and what an hour costs. Cloud grows a size control in place and the session estimate rolls as you choose.

ProWhere to run the payouts task. Cloud grows a size control in place, the estimate rolls with the size, and Start provisions the sandbox.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/environment-picker

Usage

tsx
import { EnvironmentPicker } from "@/components/ui/chatcn/pro/environment-picker"

<EnvironmentPicker options={environments} defaultValue="cloud" onStart={start} />

Each option has a kind (local, worktree, cloud, ssh), a detail such as the host or worktree path, specs and costPerHour. Give cloud options sizes; the chosen option shows them as a segmented control and its specs and cost follow the size. An option with status: "offline" cannot be chosen and offers Reconnect; starting shows its progress in words.

Examples

States

ProThis machine at no cost, an offline SSH host, starting, read only and loading.

Props

PropTypeNotes
optionsEnvironmentOption[]kind, name, detail, specs, costPerHour, sizes, status, statusText
value, defaultValue, onValueChangestringChosen option
size, defaultSize, onSizeChangestringSize of the chosen option
estimateHoursnumberDefault 2
onStart, starting(id, size?) => void, booleanShows the footer with the estimate
onReconnect(id) => voidOn offline hosts
disabled, loadingboolean
labelstringGroup name. Default Environment

Keyboard

KeyAction
ArrowUp ArrowDownChoose the previous or next environment, skipping offline ones
ArrowLeft ArrowRightThe same, mirrored in right to left
Home EndFirst or last environment
TabInto the size control, then Start

Accessibility

  • A radio group with one tab stop. Each option reads its name, kind, machine and cost; offline ones are disabled and say why in words.
  • Reconnect sits outside the radio, so no control is nested in another. The estimate rolls without announcing; Start names the environment it starts.

Motion

The chosen ring and fill move in 150 ms. The estimate's digits roll in 300 ms when the size changes. Nothing moves on arrow keys beyond the selection itself.