Mode Picker

How an agent takes what you write: each mode with a line on what it's for, the current one ticked.

Does the task in your apps and hands back a file

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/mode-picker

Usage

import { ModePicker } from "./ui/uicontext/components/kit/ModePicker.ts"
const Message = UiSchema.TaggedEnum({ PickedMode: { mode: Schema.String } })// the mode is yours: pass the current one, store what the menu asks forexport const Mode = (h: Html.H<typeof Message.Type>, mode: string) =>	ModePicker(h, {		modes: [			{ id: "work", label: "Work", description: "Does the task in your apps" },			{ id: "ask", label: "Ask", description: "Answers; changes nothing" },		],		value: mode,		onPick: (picked) => Message.PickedMode({ mode: picked }),	})

API reference

Options

ModePicker options
NameTypeDescription
keystringNames the picker among others in the same view
modesrequiredMode[]—
valuerequiredstringThe current mode's id
onPickrequired(mode: string) => Message—
size"sm" | "md""sm" in a composer, "md" beside a title
disabledboolean—

Source