MCPcopy
hub / github.com/claude-code-best/claude-code / ThinkingToggle

Function ThinkingToggle

src/components/ThinkingToggle.tsx:17–115  ·  view source on GitHub ↗
({ currentValue, onSelect, onCancel, isMidConversation }: Props)

Source from the content-addressed store, hash-verified

15};
16
17export function ThinkingToggle({ currentValue, onSelect, onCancel, isMidConversation }: Props): React.ReactNode {
18 const exitState = useExitOnCtrlCDWithKeybindings();
19 const [confirmationPending, setConfirmationPending] = useState<boolean | null>(null);
20
21 const options = [
22 {
23 value: 'true',
24 label: 'Enabled',
25 description: 'Claude will think before responding',
26 },
27 {
28 value: 'false',
29 label: 'Disabled',
30 description: 'Claude will respond without extended thinking',
31 },
32 ];
33
34 // Use configurable keybinding for ESC to cancel/go back
35 useKeybinding(
36 'confirm:no',
37 () => {
38 if (confirmationPending !== null) {
39 setConfirmationPending(null);
40 } else {
41 onCancel?.();
42 }
43 },
44 { context: 'Confirmation' },
45 );
46
47 // Use configurable keybinding for Enter to confirm in confirmation mode
48 useKeybinding(
49 'confirm:yes',
50 () => {
51 if (confirmationPending !== null) {
52 onSelect(confirmationPending);
53 }
54 },
55 { context: 'Confirmation', isActive: confirmationPending !== null },
56 );
57
58 function handleSelectChange(value: string): void {
59 const selected = value === 'true';
60 if (isMidConversation && selected !== currentValue) {
61 setConfirmationPending(selected);
62 } else {
63 onSelect(selected);
64 }
65 }
66
67 return (
68 <Pane color="permission">
69 <Box flexDirection="column">
70 <Box marginBottom={1} flexDirection="column">
71 <Text color="remember" bold>
72 Toggle thinking mode
73 </Text>
74 <Text dimColor>Enable or disable thinking for this session.</Text>

Callers

nothing calls this directly

Calls 4

useKeybindingFunction · 0.85
onCancelFunction · 0.50
onSelectFunction · 0.50

Tested by

no test coverage detected