Modal Example

A capture dialog bound to a command — type, Enter, gone.

Modal
Cowork Studio
workspace

Quick add

Buy oat milk

Enter to save · Esc to close

An app with no persistent UI: a command opens a modal, you type a task, hit Enter, and it appends to tasks.json and closes.

Use this shape for capture flows — anything where the whole interaction is "give me one input from anywhere and get out of the way".

Installation

cowork template install tasks-modal

Code

// Cowork/Apps/quick-add.jsx — surface: modal
export default function QuickAdd({ storage, modal }) {
  const [tasks, setTasks] = storage.useJson('tasks.json', []);
  return (
    <input autoFocus placeholder="Add a task…"
      onKeyDown={(e) => {
        if (e.key !== 'Enter') return;
        setTasks([...tasks, { text: e.target.value }]);
        modal.close();
      }} />
  );
}