MCPcopy
hub / github.com/JedWatson/react-select / handleKeyDown

Function handleKeyDown

docs/examples/CreatableInputOnly.tsx:23–32  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

21 const [value, setValue] = React.useState<readonly Option[]>([]);
22
23 const handleKeyDown: KeyboardEventHandler = (event) => {
24 if (!inputValue) return;
25 switch (event.key) {
26 case 'Enter':
27 case 'Tab':
28 setValue((prev) => [...prev, createOption(inputValue)]);
29 setInputValue('');
30 event.preventDefault();
31 }
32 };
33
34 return (
35 <CreatableSelect

Callers

nothing calls this directly

Calls 2

setInputValueFunction · 0.85
createOptionFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…