diff --git a/src/components/CommaSeparatedInput.tsx b/src/components/CommaSeparatedInput.tsx index 808cc186..752430bf 100644 --- a/src/components/CommaSeparatedInput.tsx +++ b/src/components/CommaSeparatedInput.tsx @@ -18,6 +18,9 @@ export default function CommaSeparatedInput({ onChange?: (value: string) => void options?: string[] } & Omit, 'onChange'>) { + const lastTerm = value?.split(',').slice(-1)?.[0].trim(); + const hasLastTerm = lastTerm && !optionsRaw.includes(lastTerm); + const items = (convertStringToArray(value) ?? []) .map(tag => tag.trim()) .filter(Boolean); @@ -57,10 +60,16 @@ export default function CommaSeparatedInput({ /> } - {options && + {(options || hasLastTerm) && + {hasLastTerm && + + Create {`"${lastTerm}"`} + } {options.map((tag) => (