MCPcopy Create free account
hub / github.com/adobe/react-spectrum / InsertTokenMenuItem

Function InsertTokenMenuItem

packages/@react-spectrum/ai/src/PromptField.tsx:815–830  ·  view source on GitHub ↗
(props: InsertTokenMenuItemProps)

Source from the content-addressed store, hash-verified

813> {}
814
815export function InsertTokenMenuItem(props: InsertTokenMenuItemProps) {
816 let insert = useInsertPromptSegment(item => [
817 {type: 'token', text: 'command' in item ? item.command : item.title, value: item},
818 {type: 'text', text: ' '}
819 ]);
820
821 return (
822 <MenuItem
823 {...props}
824 onAction={() => {
825 insert(props.value);
826 props.onAction?.();
827 }}
828 />
829 );
830}
831
832export interface InsertTextMenuItemProps extends Omit<
833 MenuItemProps,

Callers

nothing calls this directly

Calls 2

useInsertPromptSegmentFunction · 0.85
insertFunction · 0.50

Tested by

no test coverage detected